connordavenport / Theme-Manager

Theme Manager is a RoboFont extension for reading, writing, and storing custom glyph view themes.
13 stars 5 forks source link

Follow lib keys updated in RF #10

Closed frankrolf closed 1 year ago

frankrolf commented 1 year ago

I noticed that setting the color of BCP handles via Theme Manager did not work. The reason for this is that some color keys have been updated within RF:

glyphViewHandlesStrokeColor: glyphViewCubicHandlesStrokeColor
glyphViewHandlesQuadStrokeColor: glyphViewQuadraticHandlesStrokeColor
glyphViewOffCurvePointsStroke: glyphViewOffCurveCubicPointsStroke
glyphViewMetricsColor: glyphViewFontMetricsStrokeColor
glyphViewMeasurementsForgroundColor: glyphViewMeasurementsForegroundColor

I ran into issues with existing themes requesting outdated keys, which is why I implemented a fallback system — any colors not found by a given key are re-set to 50% grey.

The fallback system works by using the dict.get(key, fallback) method (instead of dict['key']), and currently only is implemented for the changed keys. Please let me know if I should make it consistent and extend the same approach to all the other color keys.