You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# [209_16] Fix Python syntax highlighting and active line opacity in dark mode
2
+
3
+
### What
4
+
1. Adjusted the syntax highlighting colors for the Python plugin (`python-lang.scm`) to use lighter color variants that are clearly legible on both light and dark backgrounds.
5
+
2. Explicitly mapped the `syntax:python:declare_module` override to lighter blue (for `import` and `from`) since it previously fell back to the dark blue default.
6
+
4. Modified opacity of `focus-color` in (`dark.ts`) from (`#3A86FF`) to (`#3A86FF33`) so that the active line marker no longer completely blocks text when a dark theme is active.
7
+
8
+
### Why
9
+
With the dark theme enabled, several syntax colors mapped in the Python language definition were illegible or had contrast issues against the dark gray background. Furthermore, the active line of code feature generated an opaque background because its hexadecimal color was missing transparency, rendering the text on the active line invisible.
10
+
11
+
### How
12
+
In `TeXmacs/plugins/python/progs/code/python-lang.scm`:
13
+
- Updated `define-preferences` hex values and named color mappings to use bright, pastel versions of the original colors.
14
+
15
+
In `TeXmacs/packages/themes/dark/dark.ts`:
16
+
- Replaced the opaque `focus-color` assignment with an 8-character hex code specifying ~20% opacity.
17
+
18
+
```diff
19
+
- <assign|focus-color|##3A86FF>
20
+
+ <assign|focus-color|##3A86FF33>
21
+
```
22
+
23
+
## How to test
24
+
1. Open Mogan and enable the dark GUI theme(`Document -> Theme -> Dark`).
25
+
2. Start a Python session (`Insert -> Session -> Python`) or write Python code block.
26
+
3. Verify that the new syntax highlighting is easily readable.
27
+
4. Move the cursor across different lines to see that the active line highlight (`focus-color`) acts as a translucent overlay rather than an opaque block.
28
+
5. Disable the dark theme and verify that the syntax highlighting colors still provide sufficient contrast on the default light background.
0 commit comments