From 5cceb1e6ed5c2d56abbb7a401c475edd8bbdedd9 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Mon, 4 Nov 2024 23:39:44 +0100 Subject: [PATCH] Choose light colors for the groups --- Gemfile | 3 ++- Gemfile.lock | 2 ++ app/models/group.rb | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Gemfile b/Gemfile index f61ed2f..bb8942b 100644 --- a/Gemfile +++ b/Gemfile @@ -33,4 +33,5 @@ group :development do gem 'web-console' end -gem "solid_queue", "~> 1.0" +gem 'chroma' +gem 'solid_queue', '~> 1.0' diff --git a/Gemfile.lock b/Gemfile.lock index 05575bf..58e83a3 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -84,6 +84,7 @@ GEM bootsnap (1.18.4) msgpack (~> 1.2) builder (3.3.0) + chroma (0.2.0) coderay (1.1.3) concurrent-ruby (1.3.4) connection_pool (2.4.1) @@ -326,6 +327,7 @@ PLATFORMS DEPENDENCIES bootsnap + chroma csv debug factory_bot_rails diff --git a/app/models/group.rb b/app/models/group.rb index 417e2c6..cf7cba0 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -16,6 +16,8 @@ class Group < ApplicationRecord private def set_color - self.color = "##{SecureRandom.hex(3)}" + new_color = "##{SecureRandom.hex(3)}".paint + new_color = new_color.lighten(30) if new_color.dark? + self.color = new_color end end