"lib/puppet/dotfiles/lib/colorscheme.rb" did not exist on "90fff8aca1eb728e6972f658c9120b3ccad93ae3"
Commit 68895298 authored by James T. Lee's avatar James T. Lee
Browse files

colorscheme: Try weighting difference by perception indexes

parent 6cfe0237
...@@ -49,9 +49,9 @@ class ColorScheme ...@@ -49,9 +49,9 @@ class ColorScheme
[r, g, b] [r, g, b]
end end
# XXX: This doesn't take into account human perception # XXX: I don't think this is very accurate, but we'll see
def -(other) def -(other)
Math.sqrt((r - other.r) ** 2 + (g - other.g) ** 2 + (b - other.b) ** 2) Math.sqrt(0.2989 * (r - other.r) ** 2 + 0.5870 * (g - other.g) ** 2 + 0.1140 * (b - other.b) ** 2)
end end
end end
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment