Skip to content

Commit

Permalink
feat(CMYK): Convert new color to project color model
Browse files Browse the repository at this point in the history
  • Loading branch information
troopa81 committed Aug 14, 2024
1 parent b3f4170 commit 5f3d887
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/core/symbology/qgssymbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down

0 comments on commit 5f3d887

Please sign in to comment.