posit-dev / great-tables

Make awesome display tables using Python.
https://posit-dev.github.io/great-tables/
MIT License
1.43k stars 48 forks source link

Resolve issue with `table_font_color` not accepting named colors #285

Closed jrycw closed 2 months ago

jrycw commented 2 months ago

It appears we're having an issue with the Table Theme Options -> Set options across table parts section.

image

The problem seems to arise when color values are input using common names like yellow or white, causing the font_color not to transform them into the appropriate hexadecimal format.

To address this issue, I've implemented a conversion pattern similar to the one used in font_color, which should hopefully resolve the issue.

Additionally, I noticed quick returns in the first few lines of font_color. I'm uncertain whether these also need conversion. Could the team please review this aspect?

codecov-commenter commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 81.71%. Comparing base (479eb73) to head (7008372).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #285 +/- ## ======================================= Coverage 81.71% 81.71% ======================================= Files 41 41 Lines 4325 4327 +2 ======================================= + Hits 3534 3536 +2 Misses 791 791 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

machow commented 2 months ago

Thanks so much for this work! I'm pairing right now with @rich-iannone, and he mentioned this function should always return hex (which it wasn't even before this PR). I've tweaked it a bit, so that when things like "transparent" are passed, hex colors are output.

jrycw commented 2 months ago

The refactored code looks better. In fact, the variable names definitely represent their meaning clearly.