From 36a59d088eca61b834191dacea009677a96c052f Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Thu, 19 May 2022 07:33:21 +0000 Subject: Add latest changes from gitlab-org/gitlab@15-0-stable-ee --- lib/gitlab/color.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/gitlab/color.rb') diff --git a/lib/gitlab/color.rb b/lib/gitlab/color.rb index e0caabb0ec6..01c534c15a0 100644 --- a/lib/gitlab/color.rb +++ b/lib/gitlab/color.rb @@ -170,6 +170,11 @@ module Gitlab Constants::COLOR_NAME_TO_HEX[color.downcase] || new(color) end + # Generate a hex color based on hex-encoded value + def self.color_for(value) + Color.new("##{Digest::SHA256.hexdigest(value.to_s)[0..5]}") + end + def to_s @value.to_s end -- cgit v1.2.3