OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Change blend amount
Oliver Günthera2e960e6fcee
diff --git a/app/models/colors/hex_color.rb b/app/models/colors/hex_color.rbindex ab21d06673a..e8824c697f1 100644--- a/app/models/colors/hex_color.rb+++ b/app/models/colors/hex_color.rb@@ -64,15 +64,21 @@ module Colors### Darken this color by the given decimal amountdef darken(amount)- r, g, b = rgb_modify { |color| color * amount }- '#%<r>02x%<g>2x%<b>02x' % { r:, g:, b: }+ blend 0, 1 - amountend### Lighten this color by the given decimal amountdef lighten(amount)- r, g, b = rgb_modify { |color| color + (255 * amount) }- '#%<r>02x%<g>2x%<b>02x' % { r:, g:, b: }+ blend 255, 1 - amount+ end++ ##+ # Blend the color with the same mix_value for all channels+ # and the given opacity+ def blend(mix_value, opacity)+ r, g, b = rgb_modify { |channel| (channel * opacity) + (mix_value * (1 - opacity)) }+ '#%<r>02x%<g>02x%<b>02x' % { r:, g:, b: }end# rubocop:disable Metrics/AbcSize