<% # hsv_to_rgb メソッドは http://c4se.hatenablog.com/entry/2013/08/04/190937 をほぼコピーした def hsv_to_rgb(h, s, v) s /= 100.0 v /= 100.0 c = v * s x = c * (1 - ((h / 60.0) % 2 - 1).abs) m = v - c r, g, b = *( case when h < 60 then [c, x, 0] when h < 120 then [x, c, 0] when h < 180 then [0, c, x] when h < 240 then [0, x, c] when h < 300 then [x, 0, c] else [c, 0, x] end ) [r, g, b].map { |channel| ((channel + m) * 255).ceil }.map { |c| '%02x' % c }.join end hues = %w( 225 225 264 296 33 43 43 43 200 93 93 93 340 208 208 208 208 208 208 ).map(&:to_i) colors = hues.map { |h| [hsv_to_rgb(h, 100, 80), hsv_to_rgb(h, 100, 100)] } ids = (0..9).to_a + ('a'..'z').to_a colors.each.with_index(1) do |(color, active_color), index| %> #\:<%= ids[index] %> { .blocklyTreeRow { padding-top: 0.25em; padding-bottom: 0.25em; border-left: 0.75em solid #<%= color %>; } .blocklyTreeRow.blocklyTreeSelected { color: white; font-weight: bold; background-color: #<%= active_color %> !important; } } <% end %>