Files
fizzy/app/models/color.rb
T
Jorge Manrubia 80d309cd22 Keep current logical names for colors
So that the db values are not tied to the specific CSS
2025-11-14 11:44:04 +01:00

26 lines
590 B
Ruby

Color = Struct.new(:name, :value)
class Color
class << self
def for_value(value)
COLORS.find { |it| it.value == value }
end
end
def to_s
value
end
COLORS = {
"Blue" => "var(--color-card-default)",
"Gray" => "var(--color-card-1)",
"Tan" => "var(--color-card-2)",
"Yellow" => "var(--color-card-3)",
"Lime" => "var(--color-card-4)",
"Aqua" => "var(--color-card-5)",
"Violet" => "var(--color-card-6)",
"Purple" => "var(--color-card-7)",
"Pink" => "var(--color-card-8)"
}.collect { |name, value| new(name, value) }.freeze
end