Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set default background back to none #24

Merged
merged 4 commits into from
May 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.1.0
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

## [0.2.6] - 2019-03-23
### Added
- Readme troubleshooting for librsvg2-bin package missing
### Fixed
- ICO convert uses background config

## [0.2.5] - 2019-01-16
### Changed
- Strike GraphicsMagick at Readme because it's compatible a this moment
Expand Down
12 changes: 6 additions & 6 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
PATH
remote: .
specs:
jekyll-favicon (0.2.5)
jekyll-favicon (0.2.6)
jekyll (~> 3.0)
mini_magick (~> 4.5)

GEM
remote: https://rubygems.org/
specs:
addressable (2.5.2)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
ast (2.4.0)
colorator (1.1.0)
concurrent-ruby (1.1.4)
concurrent-ruby (1.1.5)
em-websocket (0.5.1)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.6.0)
Expand Down Expand Up @@ -40,12 +40,12 @@ GEM
jekyll-watch (2.0.0)
listen (~> 3.0)
kramdown (1.17.0)
liquid (4.0.1)
liquid (4.0.3)
listen (3.0.8)
rb-fsevent (~> 0.9, >= 0.9.4)
rb-inotify (~> 0.9, >= 0.9.7)
mercenary (0.3.6)
mini_magick (4.9.2)
mini_magick (4.9.3)
mini_portile2 (2.3.0)
minitest (5.11.3)
minitest-hooks (1.5.0)
Expand Down Expand Up @@ -73,7 +73,7 @@ GEM
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.10.0)
safe_yaml (1.0.4)
safe_yaml (1.0.5)
sass (3.7.3)
sass-listen (~> 4.0.0)
sass-listen (4.0.0)
Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,18 @@ Features: Cipher DPC HDRI Modules
Delegates (built-in): bzlib freetype jng jpeg ltdl lzma png tiff xml zlib
```

If you have a [problem converting SVG files](https://github.com/afaundez/jekyll-favicon/issues/9#issuecomment-473862194), you may need to install the package `librsvg2-bin`. For example, in Ubuntu/Debian systems:

```sh
sudo apt install librsvg2-bin
```

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'jekyll-favicon', '~> 0.2.5', group: :jekyll_plugins
gem 'jekyll-favicon', '~> 0.2.6', group: :jekyll_plugins
```

## Usage
Expand Down
4 changes: 2 additions & 2 deletions lib/jekyll/favicon/config/defaults.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
favicon:
source: favicon.svg
path: /assets/images
background: white
background: none
apple-touch-icon:
background: white
background: none
sizes:
- 57x57
- 76x76
Expand Down
1 change: 0 additions & 1 deletion lib/jekyll/favicon/icon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ def ico_options
options = {}
sizes = Favicon.config['ico']['sizes']
options[:background] = background_for sizes.first
options[:alpha] = 'off'
options[:resize] = sizes.first
ico_sizes = sizes.collect { |size| size.split('x').first }.join ','
options[:define] = "icon:auto-resize=#{ico_sizes}"
Expand Down
2 changes: 1 addition & 1 deletion lib/jekyll/favicon/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Jekyll
module Favicon
VERSION = '0.2.5'.freeze
VERSION = '0.2.6'.freeze
end
end
2 changes: 1 addition & 1 deletion test/fixtures/sites/minimal/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
42 changes: 42 additions & 0 deletions test/jekyll/favicon/generator_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,21 @@
end
end

it 'should honor SVG colors' do
img = MiniMagick::Image.open File.join @options['destination'], 'assets',
'images',
'favicon-16x16.png'
pixels = img.get_pixels
assert_equal [0, 0, 0], pixels[0][0]
assert_equal [220, 20, 60], pixels[8][8]
img = MiniMagick::Image.open File.join @options['destination'], 'assets',
'images',
'favicon-57x57.png'
pixels = img.get_pixels
assert_equal [0, 0, 0], pixels[0][0]
assert_equal [220, 20, 60], pixels[26][26]
end

it 'should create a webmanifest' do
assert File.exist? File.join @destination,
@defaults['chrome']['manifest']['target']
Expand All @@ -64,6 +79,33 @@
end
end

describe 'when site uses default SVG favicon' do
before :all do
@options['source'] = fixture 'sites', 'minimal'
@options['favicon'] = { 'background' => 'red' }
@config = Jekyll.configuration @options
@site = Jekyll::Site.new @config
@site.process
@destination = @options['destination']
@defaults = Jekyll::Favicon::DEFAULTS
end

it 'should honor SVG colors' do
img = MiniMagick::Image.open File.join @options['destination'], 'assets',
'images',
'favicon-16x16.png'
pixels = img.get_pixels
assert_equal [255, 0, 0], pixels[0][0]
assert_equal [220, 20, 60], pixels[8][8]
img = MiniMagick::Image.open File.join @options['destination'], 'assets',
'images',
'favicon-57x57.png'
pixels = img.get_pixels
assert_equal [255, 0, 0], pixels[0][0]
assert_equal [220, 20, 60], pixels[26][26]
end
end

describe 'when site uses default PNG favicon' do
before :all do
@options['source'] = fixture 'sites', 'minimal-png-source'
Expand Down