Skip to content

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

use Color#normalize_hexcode to "unpack" short color hexcode

as-opf3645e002675
diff --git a/app/models/work_package/pdf_export/cover.rb b/app/models/work_package/pdf_export/cover.rb
index 3df517d55d6..febaa9f6997 100644
--- a/app/models/work_package/pdf_export/cover.rb
+++ b/app/models/work_package/pdf_export/cover.rb
@@ -67,14 +67,15 @@ module WorkPackage::PDFExport::Cover
def validate_cover_text_color
return nil if CustomStyle.current.blank?
- color = CustomStyle.current.export_cover_text_color
- return nil if color.blank?
+ hexcode = CustomStyle.current.export_cover_text_color
+ return nil if hexcode.blank?
+
+ color = Color.new({ hexcode: })
+ color.normalize_hexcode
+ return nil if color.hexcode.blank?
# pdf hex colors are defined without leading hash
- color = color.sub('#', '')
- # prawn does not support short notation like #000
- color = color + color if color.size == 3
- color
+ color.hexcode.sub('#', '')
end
def write_hero_title(top, width)