p5.js-web-editor icon indicating copy to clipboard operation
p5.js-web-editor copied to clipboard

Syntax highlighting for conditional logic if/then broken in high-contrast theme

Open bmoren opened this issue 2 months ago • 5 comments

p5.js version

2.3.3

What is your operating system?

Mac OS

Web browser and version

Chrome 153.0.8010.37 (Official Build) (arm64)

Actual Behavior

Syntax Highlighting for conditional logic is grey.

Expected Behavior

Syntax Highlighting for conditional logic turns yellow

Steps to reproduce

This seems to only affect Hi-Con mode.

Image

bmoren avatar Sep 15 '26 14:09 bmoren

Hi @bmoren and maintainers! I'd love to work on this issue.

Root Cause

In client/modules/IDE/components/Editor/utils/highlightStyle.js (line 29), tags.controlKeyword is currently mapped to class: 'cm-operator' instead of class: 'cm-keyword':

{ tag: tags.controlKeyword, class: 'cm-operator' },

tirthraj01 avatar Sep 16 '26 17:09 tirthraj01

@bmoren Do you mind reuploading the screenshot? It's broken on the initial description.

Just wanted to validate one more thing after the screenshot is uploaded, then @tirthraj01 you can be assigned this issue. Thanks!

EDIT: Please disregard my last comment, as it was an issue on my end. I agree, let's turn on the yellow for if statements in high contrast mode. @tirthraj01 I will assign this to you. Thanks!

doradocodes avatar Sep 21 '26 23:09 doradocodes

@doradocodes sure!

Image

bmoren avatar Sep 21 '26 23:09 bmoren

Image

bmoren avatar Sep 21 '26 23:09 bmoren

Hi @doradocodes and @bmoren!

I've opened PR #4317 to resolve this issue:

  • Mapped tags.controlKeyword to cm-keyword in highlightStyle.js so conditional logic (if, else, etc.) turns yellow in high-contrast mode as expected.
  • Updated the corresponding documentation comments in _editor.scss.
  • Verified that all TypeScript typechecks, linters, and unit tests pass cleanly.

Please feel free to review whenever you have a chance! Thank you!

tirthraj01 avatar Sep 22 '26 01:09 tirthraj01