falu 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f08793b49c9cd82d6a486fd2903dc1041a1a2f73
4
- data.tar.gz: 309a1a89a69629163ad945f854c1577dd6607d34
3
+ metadata.gz: a4df7374b394281ccf58ca3834914be2341b12e6
4
+ data.tar.gz: ae16e01cf378501cd2d36bb7092b6abcb798e27c
5
5
  SHA512:
6
- metadata.gz: b2ed04569779b47dddf8782a6bc08aba512300bb13b111abbf5ab890844d0bc906ee3b8e2db9537381a3d80d0594a04c0548b7ab4068d5e40487af9f2e203db1
7
- data.tar.gz: 704decaa5d473ee1c5516a332b70d211896ec8af94396c7f9bdd7a77de207491853b4e0ad610a532ccdf99069d37be63bfa95c563bc43c68a7209090dc0ddb94
6
+ metadata.gz: feaf26e05189fd0db64511826450a55dbf55f8ad4bc69de20e483e332a3e495d1226bf7ab91fa37c606ccd835b873f379e1111cef3c733b303dacd6c59c86094
7
+ data.tar.gz: 4191f7a9fbe5650d25e4ef193e79bccbe9b584306b9c5c315a9316c2f7930e24152dd27cb381d0675a861041a42a32ff4178fb0057ba91c0487338423b50fa30
@@ -1,5 +1,6 @@
1
1
  require 'canfig'
2
2
  require 'active_support/core_ext/module'
3
+ require 'active_support/core_ext/enumerable'
3
4
  require 'active_support/core_ext/object/json'
4
5
  require 'mini_magick'
5
6
  require 'falu/image'
@@ -114,7 +114,7 @@ module Falu
114
114
  end
115
115
 
116
116
  def primary
117
- @primary ||= dominant
117
+ @primary ||= dominant#(3).sort_by { |swtch| swtch.color.rgb.colors.sum }.first
118
118
  end
119
119
 
120
120
  def secondary=(sec)
@@ -123,7 +123,9 @@ module Falu
123
123
  end
124
124
 
125
125
  def secondary
126
- @secondary ||= dominant(2).last
126
+ @secondary ||= begin
127
+ dominant(3).last(2).sort_by { |swtch| (swtch.color.rgb.colors.sum - primary.color.rgb.colors.sum).abs }.last
128
+ end
127
129
  end
128
130
 
129
131
  def accent=(acc)
@@ -132,7 +134,7 @@ module Falu
132
134
  end
133
135
 
134
136
  def accent
135
- @accent ||= dominant(3).last
137
+ @accent ||= dominant(3).find { |swtch| ![primary.color.to_s, secondary.color.to_s].include?(swtch.color.to_s) }
136
138
  end
137
139
 
138
140
  def as_json(options={})
@@ -2,7 +2,7 @@ module Falu
2
2
  module Version
3
3
  MAJOR = '0'
4
4
  MINOR = '0'
5
- PATCH = '3'
5
+ PATCH = '4'
6
6
  VERSION = "#{MAJOR}.#{MINOR}.#{PATCH}"
7
7
 
8
8
  class << self
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: falu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark Rebec