From 5f3d88784e04f4c55a2efc97c9b96ece52589f28 Mon Sep 17 00:00:00 2001 From: Julien Cabieces Date: Wed, 14 Aug 2024 17:20:36 +0200 Subject: [PATCH] feat(CMYK): Convert new color to project color model --- src/core/symbology/qgssymbol.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/symbology/qgssymbol.cpp b/src/core/symbology/qgssymbol.cpp index 7cc92f51a8ed..0df9346fdcb7 100644 --- a/src/core/symbology/qgssymbol.cpp +++ b/src/core/symbology/qgssymbol.cpp @@ -864,6 +864,16 @@ QgsSymbol *QgsSymbol::defaultSymbol( Qgis::GeometryType geomType ) s->setColor( QgsApplication::colorSchemeRegistry()->fetchRandomStyleColor() ); } + const bool isCmyk = QgsProject::instance()->styleSettings() && QgsProject::instance()->styleSettings()->colorModel() == Qgis::ColorModel::Cmyk; + if ( s->color().spec() == QColor::Spec::Rgb && isCmyk ) + { + s->setColor( s->color().toCmyk() ); + } + else if ( s->color().spec() == QColor::Spec::Cmyk && !isCmyk ) + { + s->setColor( s->color().toRgb() ); + } + return s.release(); }