Repository navigation
Load theme for raw code - #1675
Conversation
8b86b2b to
ef1ae5e
Compare
|
About not inheriting the foreground color: I see how it makes sense, but is there any way to configure it now for block-level raw text? Regarding the |
A simple override rule could be implemented as follows (just what it was): typst/crates/typst-library/src/text/raw.rs Lines 335 to 342 in 1bb024c The problem is that we cannot enable it by default, since it corrupts many themes. We could consider configure it in the
If we don't have a I wasn't previously familiar with the concept of a "synthesized field". If you could provide guidance on which files to refer to, I can check it and rework on |
4027724 to
50a42f6
Compare
I think that's good enough for now. They'll have to write a show rule for the rectangle anyway, so copying the color won't be that big of a deal. Of course, reading it is cleaner and more composable, but it's a minor issue for now. Synthesized fields are basically field that are constructed from other fields in |
|
So, in principle, this looks good to merge now. The only thing I'm still unsure about is the foreground thing. Even if we use no theme at all, we couldn't affect the text color anymore because it defaults to the one from THEME, if I understand correctly. |
I understand it now. This could be weird if we cannot affect text in raw code at all, such as So we should find a way to make theme settings available in context of The efforts related to |
|
I don't understand how having access to theme properties would help if the default is to respect the theme's foreground color. The other way around it would make sense: If we ignore the foreground color from the theme and let the user set it manually, then they could write a show rule that sets the text color to the one from the theme. But if do it like that, this PR isn't blocked, we would just need to revert the foreground change. |
50a42f6 to
0ca0a82
Compare
|
@laurmaedje I have rolled back the changes about foreground color in the commit 42d7b97 The rest commits are kept. |
|
Thank you! Also for your patience with the foreground/background discussion. I think of this as the minimal, initial approach and am optimistic that we'll find a good solution for foreground/background handling down the road. |


This PR adds an option
themeto therawelement.It introduces several changes which can be argued:
Set default value
txtto lang optionSet default value
txtto lang option, otherwise Syntect does not fill any color for text in raw code, which is not good to dark themes.A
txthighlighter will simply attach atext.plainscope to the whole raw text:https://github.com/trishume/syntect/blob/f0ece85c5a2dc4436442558babd9fc159dca372b/src/parsing/syntax_set.rs#L457-L467
Always use foreground color from the theme settingTypst should not override foreground color (to black color) for dark themes. It is also meaningless to detect whether a theme is in dark style. So I removed the raw element inheriting foreground color from ancestors.Under draft: It is under drafting since it introduced another non-trivial option, which needs to discuss. It adds astylingoption which is of type...