branding 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +28 -4
- data/lib/branding/png.rb +2 -0
- data/lib/branding/railtie.rb +7 -4
- data/lib/branding/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84f12d04e4345b16255303cead54dd8dc0fc861b
|
4
|
+
data.tar.gz: 0e29efd611b2ab5c9f16459a6312321b376566c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e1fb915ef2b0cdb5c7fa4b03056c3462112866c79ac02caa33e6fe43aaf18bb032c91514c03700c2bf80fc4ab5c4d851b50fd0066d729c5e1c6a75a036cb9fb
|
7
|
+
data.tar.gz: 29d28dbacb70e62f3337250ca181f959c4a5286d9c3a7eab08407d8f583af8333f7b597a59ffc34a3ce97673fb862542ed0f332359e4f7fe24b38651596578bd
|
data/README.md
CHANGED
@@ -1,12 +1,14 @@
|
|
1
1
|
# Branding
|
2
2
|
|
3
|
-
Proud of your code? Add some
|
3
|
+
Proud of your code? Add some _bling_ to your terminal.
|
4
|
+
|
5
|
+
[](https://asciinema.org/a/9gk8mur6c5gmff67to3y1l1a1)
|
4
6
|
|
5
7
|
## Perks
|
6
8
|
|
7
9
|
* No dependencies!
|
8
10
|
* Pure Ruby PNG decoding in < 200 LoC
|
9
|
-
* Hi-Res mode for
|
11
|
+
* Hi-Res mode for 4x pixel density!
|
10
12
|
* Hi-Color mode for 720 colors!!
|
11
13
|
* Loads of fun!
|
12
14
|
|
@@ -20,15 +22,37 @@ Branding will detect your Rails application's favicon. It adds a small
|
|
20
22
|
initializer in development and testing environments that draws the favicon with
|
21
23
|
ANSI control characters whenever you run tests, a rake task or boot the console.
|
22
24
|
|
25
|
+
### Hi-Res mode
|
26
|
+
|
27
|
+
`hires` mode is a technique where we can 4x the "pixel" density of the
|
28
|
+
terminal. This is accomplished by using the half-height unicode characters.
|
29
|
+
|
30
|
+
Some terminal fonts do not render these characters very well and there are some artifacts.
|
31
|
+
|
32
|
+
So far, `Inconsolata` has yield the best results.
|
33
|
+
|
23
34
|
## Installation
|
24
35
|
|
25
36
|
Add this line to your application's Gemfile:
|
26
37
|
|
27
|
-
|
38
|
+
```ruby
|
39
|
+
gem 'branding'
|
40
|
+
```
|
28
41
|
|
29
42
|
## Usage
|
30
43
|
|
31
|
-
|
44
|
+
If you're adding branding to your Rails project, there is no more
|
45
|
+
configuration. To test how images look in the terminal:
|
46
|
+
|
47
|
+
```shell
|
48
|
+
branding logo-72x72.png
|
49
|
+
```
|
50
|
+
|
51
|
+
To test out **hires mode**, try:
|
52
|
+
|
53
|
+
```shell
|
54
|
+
branding -p hires logo-144x144.png
|
55
|
+
```
|
32
56
|
|
33
57
|
## Contributing
|
34
58
|
|
data/lib/branding/png.rb
CHANGED
data/lib/branding/railtie.rb
CHANGED
@@ -7,10 +7,12 @@ module Branding
|
|
7
7
|
rows, cols = Canvas.terminal_size
|
8
8
|
ideal_width = cols / 6
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
10
|
+
if icon_path = Branding::Railtie.best_icon(ideal_width)
|
11
|
+
logo = Branding::Logo.new(icon_path)
|
12
|
+
logo.algo = :hires
|
13
|
+
logo.print
|
14
|
+
print "\n"
|
15
|
+
end
|
14
16
|
rescue
|
15
17
|
# We don't want to do anything if this causes an exception. Your time
|
16
18
|
# is too valuable to be dealing with busted amusement gems.
|
@@ -27,6 +29,7 @@ module Branding
|
|
27
29
|
end
|
28
30
|
|
29
31
|
if paths.empty?
|
32
|
+
nil
|
30
33
|
else
|
31
34
|
paths.first
|
32
35
|
end
|
data/lib/branding/version.rb
CHANGED