Module: Plutonium::UI::Kanban::ColorDot

Included in:
Column, Resource
Defined in:
lib/plutonium/ui/kanban/color_dot.rb

Overview

Shared color-dot rendering for the board shell placeholder header (Resource) and the loaded column header (Column), so a column's color: shows consistently in both states.

Instance Method Summary collapse

Instance Method Details

#color_css_value(color) ⇒ Object

Maps a column color symbol to a CSS value via Tailwind design tokens. Raw CSS strings (e.g. "#ff0000") are passed through unchanged.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/plutonium/ui/kanban/color_dot.rb', line 19

def color_css_value(color)
  case color.to_sym
  when :red then "var(--color-red-500)"
  when :orange then "var(--color-orange-500)"
  when :amber then "var(--color-amber-500)"
  when :yellow then "var(--color-yellow-500)"
  when :green then "var(--color-green-500)"
  when :blue then "var(--color-blue-500)"
  when :purple then "var(--color-purple-500)"
  when :pink then "var(--color-pink-500)"
  when :gray then "var(--pu-text-muted)"
  else color.to_s
  end
end

#render_color_dot(color) ⇒ Object



10
11
12
13
14
15
# File 'lib/plutonium/ui/kanban/color_dot.rb', line 10

def render_color_dot(color)
  span(
    class: "shrink-0 w-2.5 h-2.5 rounded-full",
    style: "background-color: #{color_css_value(color)}"
  )
end