fix(playground): align Night Owl theme with website Prism rendering#26
Open
taiman724 wants to merge 1 commit into
Open
fix(playground): align Night Owl theme with website Prism rendering#26taiman724 wants to merge 1 commit into
taiman724 wants to merge 1 commit into
Conversation
Add token-rule overrides on top of monaco-themes' Night Owl so the
playground's Monaco editor matches the Prism Night Owl theme used on
the wcc.dev website:
- comment / comment.line.double-slash: render in italic to match
Prism's '.token.comment { font-style: italic }'
- string.quoted / string.quoted.double / string.quoted.single:
use #addb67 (the green Prism uses for all .token.string) instead of
monaco-themes' #ecc48d peach, so JS string literals look the same in
both renderings
Verified locally by running 'npm run dev' and visually comparing the
playground at http://localhost:1984 with the code samples on
https://wcc.dev/.
Closes ProjectEvergreen#23
✅ Deploy Preview for merry-croissant-ba6f9d ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
playground (Monaco Editor) と wcc.dev website (Prism) の Night Owl 表示を揃えるため、
src/scripts/repl-init.tsで読み込んでいるmonaco-themes/themes/Night Owl.jsonの上に 2 種類の token-rule オーバーライド を追加しました。.token.comment/ コメントfont-style: italic.token.string/ JS文字列#addb67(緑、全 string 一律)string.quoted.*のみ#ecc48d(peach)#addb67に統一Monaco の token rules は順序評価で後勝ちなので、
nightOwlTheme.rulesの末尾に追記する形にしました。差分はsrc/scripts/repl-init.tsのみ・+18 行 / -0 行で済んでいます。実装内容は Prism Night Owl CSS の以下と整合:
```css
.token.comment, .token.prolog, .token.cdata {
color: rgb(99, 119, 119); /* = #637777 */
font-style: italic;
}
.token.string, .token.url, .token.entity, ... {
color: rgb(173, 219, 103); /* = #addb67 */
}
```
動作確認
リポ全体には pre-existing な `oxfmt --check` 警告 (21 files) がありますが、本 PR の変更範囲外なので別 PR の方が無難と判断し触っていません。
Closes #23