teacat / noire Goto Github PK
View Code? Open in Web Editor NEW๐จ Light/darken, mix, (de)saturate the colors in Golang with CMYK / RGB / HSV / HSL / Hex / HTML supported.
Home Page: https://godoc.org/github.com/teacat/noire
License: MIT License
๐จ Light/darken, mix, (de)saturate the colors in Golang with CMYK / RGB / HSV / HSL / Hex / HTML supported.
Home Page: https://godoc.org/github.com/teacat/noire
License: MIT License
It seems hues between 61-200 are not able to be set:
nc := noire.NewHSV(20, 100, 100)
h, s, v := nc.HSV()
fmt.Printf("h=%f s=%f v=%f\n", h, s, v)
nc = noire.NewHSV(219, 65, 100)
h, s, v = nc.HSV()
fmt.Printf("h=%f s=%f v=%f\n", h, s, v)
nc = noire.NewHSV(299, 100, 100)
h, s, v = nc.HSV()
fmt.Printf("h=%f s=%f v=%f\n", h, s, v)
output:
h=20.000000 s=100.000000 v=100.000000
h=339.000000 s=65.100000 v=100.000000
h=59.000000 s=100.000000 v=100.000000
when using a colors AdjustHue
method like below, hues between 60 and 300 do not produce the expected result:
nc := noire.NewHSV(1, 100, 100)
for i := 1; i < 360; i++ {
h, s, v = nc.HSV()
fmt.Printf("h=%f s=%f v=%f\n", h, s, v)
nc = nc.AdjustHue(1.0)
}
When creating an HSV color with saturation set to 0, the result is consistently a hue of 60, with saturation and value at 100.
Example gist: https://gist.github.com/bcicen/252002e09e55e0439bc400ca785b8bd5
Result:
input: h=320.00 s=100.00 v=100.00
color 255;0;170 h=320.00 s=100.00 v=100.00
input: h=320.00 s=70.00 v=100.00
color 255;77;196 h=320.00 s=69.80 v=100.00
input: h=320.00 s=30.00 v=100.00
color 255;179;230 h=320.00 s=29.80 v=100.00
input: h=320.00 s=10.00 v=100.00
color 255;230;247 h=319.00 s=9.80 v=100.00
input: h=320.00 s=5.00 v=100.00
color 255;242;251 h=318.00 s=5.10 v=100.00
input: h=320.00 s=0.00 v=100.00
color 255;255;0 h=60.00 s=100.00 v=100.00 # yellow
Hey thanks for this, it seems simple and to the point.
No offense, the comments/docs could be in English :D my zhong-guo zhong-wen (see?) is quite bad.. but the code is so clear that it's ok
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.