dringtech / ifg-charts

Visualisation component library for IfG
MIT License
1 stars 0 forks source link

Tweak contrast threshold #8

Closed philipnye closed 2 months ago

philipnye commented 4 months ago

I'll admit to losing track a little of how the controls for contrast colours worked - let us know if making these changes are within our control.

timeline (5)

gilesdring commented 4 months ago

This is in two parts, the first of which is relatively simple, and the second is a bit more complex...

I've added an additional property to the timeline component called contrastClip, which defaults to 165. Setting this clip lower will tend to make the text remain coloured as the contrast decreases. It was originally set to 250. You can now override this per chart, although bear in mind that setting this lower will make the charts less accessible.

The selection of white or grey as a contrast for overlays is a bit more involved. Basically, we can set the contrastColour for any category by editing the categoryColours.js. By default, these are set by finding the highest contrast between grey and white. I have overridden these for the MoS and Other Parl Role cases, but these are on a case by case basis. These are inherently less accessible than the default. Granted, this might be minimal.

philipnye commented 4 months ago

@gilesdring This sounds the right handling for these two things. When pushed to live we can double-check there aren't any unwanted consequences.

sachinsavur commented 3 months ago

Don't seem to be any unwanted consequences - happy for this to be marked as closed.