zeevallin / gradient Goto Github PK
View Code? Open in Web Editor NEWLibrary for dealing with color gradients in ruby
Home Page: http://rubygems.org/gems/gradient
License: MIT License
Library for dealing with color gradients in ruby
Home Page: http://rubygems.org/gems/gradient
License: MIT License
The Gradient::Map
initialiser sorts the initial set of points by location, which is fine if there are no repeated locations. However, in order to correctly represent discontinuities in gradients, duplicate locations need to be handled. Consider the following simple step gradient
[0.0, black], [0.5, black], [0.5. white], [1.0, white]
If we sort this array by location with a non-stable sort, such as Ruby's, then the result may be a sawtooth
[0.0, black], [0.5, white], [0.5. black], [1.0, white]
Several solutions are possible
(those would be in my order of preference), and probably others.
Hi there,
I'm using your libary to create triangle patterns and I've noticed that there seems to be an Issue with Ruby 2.7.
When I run bin/console
in ruby 2.7 I'm getting the following error:
Traceback (most recent call last):
5: from bin/console:4:in `<main>'
4: from bin/console:4:in `require'
3: from /home/wolle/projekte/gradient/lib/gradient.rb:8:in `<top (required)>'
2: from /home/wolle/projekte/gradient/lib/gradient.rb:8:in `require'
1: from /home/wolle/projekte/gradient/lib/gradient/svg.rb:1:in `<top (required)>'
/home/wolle/projekte/gradient/lib/gradient/svg.rb:1:in `require': cannot load such file -- scanf (LoadError)
scanf
cannot be loaded because it was excluded as a standard libary as of version 2.7 https://rubyreferences.github.io/rubychanges/2.7.html#libraries-excluded-from-the-standard-library
Solution:
Include scanf in your gemspec
Hi, first of all, thanks for the gem!
It would be great to describe at README the functions in the models.
I want to get a color interpolation and print as background in a table, I need the hexadecimal color, i had to inspect the code to find that it could be done with color.hex
gradient = Gradient::Map.new(
Gradient::Point.new(0, Color::RGB.new(255, 255, 255), 1.0),
Gradient::Point.new(1, Color::RGB.new(226, 82, 82), 1.0)
)
gradient.at(0.5).color.hex
I suggest to add this info to the readme and the other functions... it could help.
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.