-
Notifications
You must be signed in to change notification settings - Fork 368
feat(CodeEditor): use custom PatternFly monaco theme #11575
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Preview: https://patternfly-react-pr-11575.surge.sh A11y report: https://patternfly-react-pr-11575-a11y.surge.sh |
b301164
to
c875446
Compare
8927aef
to
701fdce
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is good. I tried to do a subtle rounding of the corners to match the container but it crops off too much so we can leave that for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just needs a rebase
what was the verdict on adding the additional CSS so that the editor background colour matches the margin? |
@logonoff are you referring to the margin color shown below, where the background color surrounding the code text/of the "JAVASCRIPT" tab is lighter than the background color of the element containing the code "Some exam"? |
yeah. in OCP I added some CSS so that these background colours match:
do you think it'd be possible (or even desirable) to include this in the base PatternFly styles? the issue is that there's no global semantic token that exists which has |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I noticed some syntax color changes in light theme that didn't seem right, but looks like there might be a bug? Not sure if it's a bug in the code editor or just a workspace issue.
When you first load the page, the syntax highlighting looks money. But if you toggle the code editor dark theme on and off, syntax highlighting changes to colors that are not accessible.
Apr-14-2025.13-41-54.mov
For simple var declarations like the screenshot below
let
is#21134d
(a very dark blue)name
is black"John"
is#003366
(another dark blue)

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
closing request. Currently it doesn't support light mod a11y correctly, and there needs to be a more indepth conversation on how to implement this. |
hey! which a11y issues did you spot with the light mode? these need to be fixed as OCP uses this exact monaco theme |
@logonoff AFAIK the only issue was the syntax highlighting in light theme. I included a small snippet at the bottom of this comment - #11575 (review). It appears like we lost most of the light theme syntax highlighting, but technically it looks like the colors just changed and don't have enough contrast to really be distinguishable from one another. |
@logonoff we maaayyy be able to get design feedback, but if I were taking a stab at it, I might just look at the default syntax highlighting that comes from Monaco, then pick the closest to those colors using our tokens. However, instead of using color palette tokens, I might use these "nonstatus" tokens we have for various colors - https://github.com/patternfly/patternfly/blob/a0dcdd6176f0a05d3dfc4ec198c1275c01b2ca61/src/patternfly/base/tokens/tokens-default.scss#L389-L415. The IMO you could take a stab at it that way (or if you had another idea), and we can ask design to review, or I'm happy to hit up design first and see if they have suggestions - just lemme know! |
What: Closes #11506
Note there should be some additional CSS in PatternFly to make this look better (so that the margin around the CodeEditor matches the monaco background color), but I'm not sure of the best way to implement it:
I tried looking into using
pf-t--global--background--color--primary--default
, but it doesn't provide enough contrast in dark mode. Meanwhile,pf-t--global--background--color--secondary--default
doesn't provide enough contrast in light mode.