Module: Twenty::ColorableMixin

Extended by:
ColorableMixin
Included in:
ColorableMixin, Project
Defined in:
lib/twenty/server/model/mixin/colorable_mixin.rb

Constant Summary collapse

COLORS =
[
  "#222222", "#333333", "#444444", "#555555", "#666666",
  "#777777", "#888888", "#999999", "#AA2222", "#22AA22",
  "#2222AA", "#AA22AA", "#CC9900", "#0099CC", "#9900CC",
  "#FF9900", "#00CC99", "#99CC00", "#CC0099", "#990000",
  "#112233", "#445566", "#778899", "#AA4455", "#5544AA",
  "#88AA44", "#AA88AA", "#CCBB00", "#1155CC", "#9900BB",
  "#DD6600", "#00BBCC", "#CC0099", "#BB3300", "#006688",
  "#993366", "#2200AA", "#557788", "#998877", "#BB4400"
]

Instance Method Summary collapse

Instance Method Details

#before_validationObject



17
18
19
20
# File 'lib/twenty/server/model/mixin/colorable_mixin.rb', line 17

def before_validation
  super if defined?(super)
  set_random_color
end

#random_colorObject



22
23
24
# File 'lib/twenty/server/model/mixin/colorable_mixin.rb', line 22

def random_color
  COLORS.sample
end