Skip to content
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

Monaco Editor: Normalize Hex code #594

Closed
5 tasks done
hiddenest opened this issue Feb 18, 2024 · 1 comment · May be fixed by NOUIY/nodejs.org#1313, NOUIY/nodejs.org#1322, NOUIY/nodejs.org#1331, NOUIY/nodejs.org#1340 or NOUIY/nodejs.org#1349
Closed
5 tasks done
Labels
help-wanted Extra attention is needed pr welcome

Comments

@hiddenest
Copy link

hiddenest commented Feb 18, 2024

Describe the bug

Monaco editor returns an error while using github-light theme by @shikijs/monaco.

Uncaught Error: Illegal value for token color: #fff

Error: Illegal value for token color: #fff
    at f.getId (tokenization.ts:173:10)
    at D (tokenization.ts:141:37)
    at _.createFromParsedTokenTheme (tokenization.ts:199:10)
    at _.createFromRawTokenTheme (tokenization.ts:195:15)
    at get tokenTheme (standaloneThemeService.ts:152:34)
    at p._toBinaryTokens (standaloneLanguages.ts:202:64)
    at p.tokenizeEncoded (standaloneLanguages.ts:241:23)
    at r (textModelTokens.ts:398:28)
    at t.updateTokensUntilLine (textModelTokens.ts:69:14)
    at c._tokenizeOneInvalidLine (textModelTokens.ts:510:33)
    at c._backgroundTokenizeForAtLeast1ms (textModelTokens.ts:487:37)
    at Object.p [as callback] (textModelTokens.ts:457:9)
    at platform.ts:191:17
    at wrapped (build.umd.js:690:53)
    at errors.ts:26:12
    at wrapped (build.umd.js:690:53)

Reproduction

Use github-light or github-dark theme by Monaco editor integrations

Suggested Solution

Format 3, 4 letter shortcut hexcodes into valid format:

  • 6 letter (RGB)
  • 8 letter (RGB + transparent)

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.
@antfu antfu transferred this issue from shikijs/textmate-grammars-themes Feb 18, 2024
@antfu antfu added help-wanted Extra attention is needed pr welcome labels Feb 18, 2024
@antfu antfu changed the title Monaco Editor Throws An Error Because Of Wrong Theme Hexcode Monaco Editor: Normalize Hex code Feb 18, 2024
@antfu antfu closed this as completed in ecb36e2 Feb 18, 2024
@hiddenest
Copy link
Author

@antfu Hi! Thanks for your quick update. However, in the new version, color set converted into wrong hexcode.
e. g. #fff become #ff0000 (You can reproduce this problem in the same github-light theme)

스크린샷 2024-02-19 오전 12 21 38

antfu added a commit that referenced this issue Feb 18, 2024
diegohaz referenced this issue in ariakit/ariakit Feb 23, 2024
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [shiki](https://togithub.com/shikijs/shiki)
([source](https://togithub.com/shikijs/shiki/tree/HEAD/packages/shiki))
| [`1.1.1` ->
`1.1.6`](https://renovatebot.com/diffs/npm/shiki/1.1.1/1.1.6) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/shiki/1.1.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/shiki/1.1.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/shiki/1.1.1/1.1.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/shiki/1.1.1/1.1.6?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>shikijs/shiki (shiki)</summary>

### [`v1.1.6`](https://togithub.com/shikijs/shiki/releases/tag/v1.1.6)

[Compare
Source](https://togithub.com/shikijs/shiki/compare/v1.1.5...v1.1.6)

#####    🚀 Features

- Provide lang sub module for alias  -  by
[@&#8203;antfu](https://togithub.com/antfu) in
[https://github.com/shikijs/shiki/issues/596](https://togithub.com/shikijs/shiki/issues/596)
[<samp>(b61a6)</samp>](https://togithub.com/shikijs/shiki/commit/b61a689b)
- Include new `Typst` grammar  -  by
[@&#8203;antfu](https://togithub.com/antfu)
[<samp>(9f70e)</samp>](https://togithub.com/shikijs/shiki/commit/9f70eed4)

#####    🐞 Bug Fixes

- **vitepress**: Missing `:shown` prop for query, fix
[#&#8203;595](https://togithub.com/shikijs/shiki/issues/595)  -  by
[@&#8203;antfu](https://togithub.com/antfu) in
[https://github.com/shikijs/shiki/issues/595](https://togithub.com/shikijs/shiki/issues/595)
[<samp>(b667b)</samp>](https://togithub.com/shikijs/shiki/commit/b667b75a)

#####     [View changes on
GitHub](https://togithub.com/shikijs/shiki/compare/v1.1.5...v1.1.6)

### [`v1.1.5`](https://togithub.com/shikijs/shiki/releases/tag/v1.1.5)

[Compare
Source](https://togithub.com/shikijs/shiki/compare/v1.1.4...v1.1.5)

#####    🐞 Bug Fixes

- **monaco**: Editor colors interop, fix
[#&#8203;594](https://togithub.com/shikijs/shiki/issues/594)  -  by
[@&#8203;antfu](https://togithub.com/antfu) in
[https://github.com/shikijs/shiki/issues/594](https://togithub.com/shikijs/shiki/issues/594)
[<samp>(78825)</samp>](https://togithub.com/shikijs/shiki/commit/788250d7)

#####     [View changes on
GitHub](https://togithub.com/shikijs/shiki/compare/v1.1.4...v1.1.5)

### [`v1.1.4`](https://togithub.com/shikijs/shiki/releases/tag/v1.1.4)

[Compare
Source](https://togithub.com/shikijs/shiki/compare/v1.1.3...v1.1.4)

#####    🚀 Features

- Add length and time limit to tokenizer  -  by
[@&#8203;ije](https://togithub.com/ije) and
[@&#8203;antfu](https://togithub.com/antfu) in
[https://github.com/shikijs/shiki/issues/588](https://togithub.com/shikijs/shiki/issues/588)
[<samp>(2803f)</samp>](https://togithub.com/shikijs/shiki/commit/2803f898)

#####    🐞 Bug Fixes

- **monaco**: Normalize hex color for monaco, fix
[#&#8203;594](https://togithub.com/shikijs/shiki/issues/594)  -  by
[@&#8203;antfu](https://togithub.com/antfu) in
[https://github.com/shikijs/shiki/issues/594](https://togithub.com/shikijs/shiki/issues/594)
[<samp>(ecb36)</samp>](https://togithub.com/shikijs/shiki/commit/ecb36e23)

#####     [View changes on
GitHub](https://togithub.com/shikijs/shiki/compare/v1.1.3...v1.1.4)

### [`v1.1.3`](https://togithub.com/shikijs/shiki/releases/tag/v1.1.3)

[Compare
Source](https://togithub.com/shikijs/shiki/compare/v1.1.2...v1.1.3)

#####    🚀 Features

- New terraform lang, update deps  -  by
[@&#8203;antfu](https://togithub.com/antfu)
[<samp>(52d0a)</samp>](https://togithub.com/shikijs/shiki/commit/52d0a62d)

#####    🐞 Bug Fixes

- **vitepress**: Don't set exit code when throws is set to false  -  by
[@&#8203;antfu](https://togithub.com/antfu)
[<samp>(e2a0a)</samp>](https://togithub.com/shikijs/shiki/commit/e2a0a432)

#####     [View changes on
GitHub](https://togithub.com/shikijs/shiki/compare/v1.1.2...v1.1.3)

### [`v1.1.2`](https://togithub.com/shikijs/shiki/releases/tag/v1.1.2)

[Compare
Source](https://togithub.com/shikijs/shiki/compare/v1.1.1...v1.1.2)

#####    🚀 Features

- New lang Move and new theme Vesper  -  by
[@&#8203;antfu](https://togithub.com/antfu)
[<samp>(8247b)</samp>](https://togithub.com/shikijs/shiki/commit/8247ba72)

#####    🐞 Bug Fixes

- Remove trailing newline added by markdown-it  -  by
[@&#8203;KermanX](https://togithub.com/KermanX) and
[@&#8203;antfu](https://togithub.com/antfu) in
[https://github.com/shikijs/shiki/issues/585](https://togithub.com/shikijs/shiki/issues/585)
[<samp>(b559c)</samp>](https://togithub.com/shikijs/shiki/commit/b559cde5)
- **twoslash**: Improve error handling  -  by
[@&#8203;antfu](https://togithub.com/antfu)
[<samp>(73fdb)</samp>](https://togithub.com/shikijs/shiki/commit/73fdbd17)

#####     [View changes on
GitHub](https://togithub.com/shikijs/shiki/compare/v1.1.1...v1.1.2)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you
are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/ariakit/ariakit).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNTMuMiIsInVwZGF0ZWRJblZlciI6IjM3LjIwMC4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment