Module: Twenty::ColorableMixin
- Extended by:
- ColorableMixin
- Included in:
- ColorableMixin, Project
- Defined in:
- lib/twenty-backend/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' ]
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.included(klass) ⇒ Object
15 16 17 |
# File 'lib/twenty-backend/model/mixin/colorable_mixin.rb', line 15 def self.included(klass) klass.before_validation :set_random_color, on: :create end |
Instance Method Details
#random_color ⇒ Object
19 20 21 |
# File 'lib/twenty-backend/model/mixin/colorable_mixin.rb', line 19 def random_color COLORS.sample end |