Sha256: fd9eeae7e17d95575eedca38f84b8ed13c8681cf039660f021408deaf114585d
Contents?: true
Size: 541 Bytes
Versions: 3
Compression:
Stored size: 541 Bytes
Contents
# frozen_string_literal: true module Polariscope module Color class Hsl MAX_HUE = 120 class << self def for(score) new(score).hsl end end def initialize(score) @score = score end def hsl return '' unless score "hsl(#{hue}, 100%, 45%)" end private attr_reader :score def hue (MAX_HUE * (rounded_score / 100.0)).round end def rounded_score (score / 5).round * 5 end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
polariscope-0.1.2 | lib/polariscope/color/hsl.rb |
polariscope-0.1.1 | lib/polariscope/color/hsl.rb |
polariscope-0.1.0 | lib/polariscope/color/hsl.rb |