Repository navigation
Conversation
thomasp85
left a comment
There was a problem hiding this comment.
Mainly, fine but some questions around naming and how it gets resolved
| * `stroke` The colour of the contour lines of glyphs or text box borders. Typically kept blank. | ||
| * `fill` The colour of the glyphs. | ||
| * `colour` Shorthand for setting `stroke` and `fill` simultaneously. | ||
| * `box` The colour of the text box. Setting this aesthetic switches on text boxes. Setting `null` (the default) does not draw text boxes. |
There was a problem hiding this comment.
Maybe background fits better with the upcoming table PR?
Also, we discussed having all of this resolved by the alias mechanism in color. Can you put some words on whether you tried that and why it didn't work
There was a problem hiding this comment.
I'm fine with using background instead of box.
I'm opposed to including it in the aliasing mechanism: you invariably want the box to have a different colour than the text. If color sets both, you're in for pain because you cannot distinguish the text from the background. Currently color sets the text glyph colour and their outline (in regular text mode) or textbox border (in textbox mode). The reason why stroke changes meaning depending on the mode is because both outlines and textboxes are different solutions to the same problem (distinguishing text from whatever is behind the text). Stacking these solutions by having both an outline and a textbox does more bad than good, so forcing one or the other (or neither) is intended behaviour.
This PR aims to fix an entry in #530.
It adds a new colour aesthetic to text layer:
box.This new name avoids the
colourpropagation rule tostroke/fill, and keepsfillfor the glyphs as before.We avoid this rule because having the same box background and glyph fill is unreadable.
strokehas separate purposes in boxless and boxed layers: in boxless layers it remains the glyph outline, in boxed layers it becomes the border colour.This means that
colour => 'red'will simultaneously set the glyph paint and border stroke.This was done deliberately because glyph outlines and text boxes both solve the same problem of contrasting text against a background so it remains readable, and having both a textbox and outline is likely an accident (or niche deliberate choice I don't understand).
Also coming with boxes is a
linewidthfor the borders, deliberately chosen to be a setting instead of a mappable aesthetic.There is also
paddingandradiusto control the spacing of the text to borders and corner rounding. I'd like to have these support relative metrics as well, but it'd have to be supported by hephaestus first.