Class: UU::OS::Form::ColorPicker::Palette

Inherits:
Object
  • Object
show all
Defined in:
uu_os_gvc-0.28.16/lib/uu/os/form/color_picker.rb

Overview

Color palette containing standard uuOS colors.

Constant Summary

GRAY =
'#e5e5e5'
STEEL =
'#8e99a1'
GOLD =
'#bead73'
DARK_VIOLET =
'#7c6ec6'
VIOLET =
'#ac8cd0'
PINK =
'#e294ba'
RED =
'#de6060'
ORANGE =
'#eb9144'
YELLOW =
'#ebb128'
LIGHT_GREEN =
'#9cbd48'
GREEN =
'#69bc72'
TURQUOISE =
'#44c0a4'
AZURE =
'#61bddd'
BLUE =
'#58a2e6'
DARK_BLUE =
'#5275c1'

Class Method Summary (collapse)

Class Method Details

+ (Hash) to_hash

Returns hash containing camelCased color names as keys and color hex codes as values. Color names can be used in other components, e.g. Button, in their style_class attribute.

Examples:

# button component colored according to the chosen color from
# colorpicker using default (this) palette
color_hex = colorpicker.value
button.style_class = UU::OS::Form::ColorPicker::Palette.to_hash().key(color_hex)

Returns:

  • (Hash)

    Hash containing camelCased color names as keys and color hex codes as values.



106
107
108
109
110
111
112
113
# File 'uu_os_gvc-0.28.16/lib/uu/os/form/color_picker.rb', line 106

def self.to_hash
  h = {}
  Palette.constants.each do |c|
    key_camel_case = c.to_s.downcase.gsub(/_./) { |match| match.slice(1,1).upcase}
    h[key_camel_case] = Palette.const_get(c)
  end
  h
end