From 001d346bc2c30351722e4f83e215440a6a44796d Mon Sep 17 00:00:00 2001 From: Johannes Rappen Date: Mon, 27 Jan 2020 21:28:57 +0100 Subject: [PATCH 1/7] chore: Update CHANGELOG with missing information --- CHANGELOG.md | 167 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 136 insertions(+), 31 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a3bd84d1..c723cf4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,38 +1,51 @@ -# Version 3.3.0 +# Changelog + +## [Version 3.3.0](https://github.com/trishume/syntect/compare/v3.2.1...v3.3.0) (2019-09-22) + +> Bug fixes and new utilities - Fixes multiple bugs - Add RangedHighlightIterator - Add `as_latex_escaped` util -# Version 3.2.1 +## [Version 3.2.1](https://github.com/trishume/syntect/compare/v3.2.0...v3.2.1) (2019-08-10) - Bump onig dependency +- inconsequential patches -# Version 3.2.0 +## [Version 3.2.0](https://github.com/trishume/syntect/compare/v3.1.0...v3.2.0) (2019-03-09) - Actually make `tokens_to_classed_spans` public like intended -# Version 3.1.0 +## [Version 3.1.0](https://github.com/trishume/syntect/compare/v3.0.2...v3.1.0) (2019-02-24) + +> Metadata and new classed HTML generation + +- Add support for loading metadata ([#223](https://github.com/trishume/syntect/pull/223) [#225](https://github.com/trishume/syntect/pull/225) [#230](https://github.com/trishume/syntect/pull/230)) +- Improve support for generating classed HTML and fix a bug, old function is deprecated because it's impossible to use correctly ([#235](https://github.com/trishume/syntect/pull/235)) +- Update `plist` to `v0.4` and `pretty_assertions` to `v0.6` ([#232](https://github.com/trishume/syntect/pull/232) [#236](https://github.com/trishume/syntect/pull/236)) + +## [Version 3.0.2](https://github.com/trishume/syntect/compare/v3.0.1...v3.0.2) (2018-11-11) + +> Bug fixes -- Add support for loading metadata (#223 #225 #230) -- Improve support for generating classed HTML and fix a bug, old function is deprecated because it's impossible to use correctly (#235) -- Update plist to v0.4 and pretty_assertions to v0.6 (#232 #236) +- Fix application of multiple `with_prototype`s ([#220](https://github.com/trishume/syntect/pull/220), fixes [#160](https://github.com/trishume/syntect/issues/160), [#178](https://github.com/trishume/syntect/issues/178), ASP highlighting) +- Fix prototype marking logic ([#221](https://github.com/trishume/syntect/pull/221), fixes [#219](https://github.com/trishume/syntect/issues/219)) -# Version 3.0.2 +## [Version 3.0.1](https://github.com/trishume/syntect/compare/v3.0.0...v3.0.1) (2018-10-16) -- Fix application of multiple `with_prototype`s (#220, fixes #160, #178, ASP highlighting) -- Fix prototype marking logic (#221, fixes #219) +> Minor bug fixes -# Version 3.0.1 +- Fix a bug with syntaxes that used captures in lookarounds ([#176](https://github.com/trishume/syntect/issues/176) [#215](https://github.com/trishume/syntect/pull/215)) +- Fix the precedence order of syntaxes to match Sublime ([#217](https://github.com/trishume/syntect/pull/217) [#216](https://github.com/trishume/syntect/pull/216)) -- Fix a bug with syntaxes that used captures in lookarounds (#176 #215) -- Fix the precedence order of syntaxes to match Sublime (#217 #216) +## [Version 3.0.0](https://github.com/trishume/syntect/compare/v2.1.0...v3.0.0) (2018-10-09) -# Version 3.0 +> Breaking changes and major new features This is a major release with multiple breaking API changes, although upgrading shouldn't be too difficult. It fixes bugs and comes with some nice new features. -## Breaking changes and upgrading +### Breaking changes and upgrading - The `SyntaxSet` API has been revamped to use a builder and an arena of contexts. See [example usage](https://github.com/trishume/syntect/blob/51208d35a6d98c07468fbe044d5c6f37eb129205/examples/gendata.rs#L25-L28). - Many functions now need to be passed the `SyntaxSet` that goes with the rest of their arguments because of this new arena. @@ -51,34 +64,126 @@ This is a major release with multiple breaking API changes, although upgrading s - `html::styles_to_coloured_html -> html::styled_line_to_highlighted_html`: also change to `newlines` `SyntaxSet` - `html::start_coloured_html_snippet -> html::start_highlighted_html_snippet`: return type also changed -## Major changes and new features +### Major changes and new features -- Use arena for contexts (#182 #186 #187 #190 #195): This makes the code cleaner, enables use of syntaxes from multiple threads, and prevents accidental misuse. +- Use arena for contexts ([#182](https://github.com/trishume/syntect/pull/182) [#186](https://github.com/trishume/syntect/pull/186) [#187](https://github.com/trishume/syntect/pull/187) [#190](https://github.com/trishume/syntect/pull/190) [#195](https://github.com/trishume/syntect/pull/195)): This makes the code cleaner, enables use of syntaxes from multiple threads, and prevents accidental misuse. - This involves a new `SyntaxSetBuilder` API for constructing new `SyntaxSet`s - See the revamped [parsyncat example](https://github.com/trishume/syntect/blob/51208d35a6d98c07468fbe044d5c6f37eb129205/examples/parsyncat.rs). -- Encourage use of newlines (#197 #207 #196): The `nonewlines` mode is often buggy so we made it easier to use the `newlines` mode. +- Encourage use of newlines ([#197](https://github.com/trishume/syntect/pull/197) [#207](https://github.com/trishume/syntect/pull/207) [#196](https://github.com/trishume/syntect/issues/196)): The `nonewlines` mode is often buggy so we made it easier to use the `newlines` mode. - Added a `LinesWithEndings` utility for iterating over the lines of a string with `\n` characters. - Reengineer the `html` module to use `newlines` syntaxes. -- Add helpers for modifying highlighted lines (#198): For use cases like highlighting a piece of text in a blog code snippet or debugger. This allows you to reach into the highlighted spans and add styles. +- Add helpers for modifying highlighted lines ([#198](https://github.com/trishume/syntect/pull/198)): For use cases like highlighting a piece of text in a blog code snippet or debugger. This allows you to reach into the highlighted spans and add styles. - Check out `split_at` and `modify_range` in the `util` module. -- New `ThemeSet::add_from_folder` function (#200): For modifying existing theme sets. +- New `ThemeSet::add_from_folder` function ([#200](https://github.com/trishume/syntect/pull/200)): For modifying existing theme sets. -## Bug Fixes +### Bug Fixes -- Improve nonewlines regex rewriting: #212 #211 -- Reengineer theme application to match Sublime: #209 -- Also mark contexts referenced by name as "no prototype" (same as ST): #180 -- keep with_prototype when switching contexts with `set`: #177 #166 -- Fix unused import warning: #174 -- Ignore trailing dots in selectors: #173 -- Fix `embed` to not include prototypes: #172 #160 +- Improve nonewlines regex rewriting: [#212](https://github.com/trishume/syntect/pull/212) [#211](https://github.com/trishume/syntect/issues/211) +- Reengineer theme application to match Sublime: [#209](https://github.com/trishume/syntect/pull/209) +- Also mark contexts referenced by name as "no prototype" (same as ST): [#180](https://github.com/trishume/syntect/pull/180) +- keep with_prototype when switching contexts with `set`: [#177](https://github.com/trishume/syntect/pull/177) [#166](https://github.com/trishume/syntect/pull/166) +- Fix unused import warning: [#174](https://github.com/trishume/syntect/pull/174) +- Ignore trailing dots in selectors: [#173](https://github.com/trishume/syntect/pull/173) +- Fix `embed` to not include prototypes: [#172](https://github.com/trishume/syntect/pull/172) [#160](https://github.com/trishume/syntect/issues/160) -## Upgraded dependencies +### Upgraded dependencies - plist: `0.2 -> 0.3` - regex: `0.2 -> 1.0` - onig: `3.2.1 -> 4.1` -# Prior versions +## [Version 2.1.0](https://github.com/trishume/syntect/compare/v2.0.1...v2.1.0) (2018-05-31) + +> Regex checking and plain file names + +* Check regexes compile upon loading from YAML (There's technically a small breaking change here if you match on the previously unused regex error, but I don't think anyone does) +* Can detect the correct syntax on full file names like `CMakeLists.txt` +* Make `nonewlines` mode marginally less buggy (still prefer using `newlines` mode) +* Better error types +* Better examples and tests + +## [Version 2.0.1](https://github.com/trishume/syntect/compare/v2.0.0...v2.0.1) (2018-04-28) + +> More robust parsing + +* Parsing now abandons a regex after reaching a recursion depth limit instead of taking forever +* Loop detection better matches Sublime Text +* Parsing is faster! +* Dependency upgrades +* Other minor tweaks + +Thanks to [@robinst](https://github.com/ronbinst) for the headline features of this release! + +## [Version 2.0.0](https://github.com/trishume/syntect/compare/v1.8.2...v2.0.0) (2018-01-02) + +> Breaking Changes and New Stuff + +### Breaking changes + +* The `static-onig` feature was removed, static linking is now the default +* Font styles and color constants now use associated consts because of bitflags upgrade +* `SyntaxDefinition::load_from_str` now has an extra parameter + +### Other notable changes + +* Support for new `embed` syntax, see [#124](https://github.com/trishume/syntect/issues/124) +* Updates to many dependencies +* Updated dumps +* More compact HTML output + +## [Version 1.8.2](https://github.com/trishume/syntect/compare/v1.8.0...v1.8.2) (2017-11-11) + +> New Inspired GitHub and libonig + +## [Version 1.8.0](https://github.com/trishume/syntect/compare/v1.7.3...v1.8.0) (2017-10-14) + +> Update bitflags & packages + +This release changes how the constants for `FontStyle` and `Color`, relying on the new associated consts feature in `Rust 1.20`. The old constants are still available but are deprecated and will be removed in `v2.0`. + +Packages were also updated to newer versions. + +## [Version 1.7.3](https://github.com/trishume/syntect/compare/v1.7.2...v1.7.3) (2017-09-15) + +> Enable comparison of parse states + +Fixes comparisons of parse states so they are fast and don't recurse infinitely. Thanks [@raphlinus](https://github.com/raphlinus) + +## [Version 1.7.2](https://github.com/trishume/syntect/compare/v1.7.0...v1.7.2) (2017-09-05) + +> Bug fixes and package updates + +* Fixes [#101](https://github.com/trishume/syntect/issues/101), which caused some syntaxes like PHP to behave incorrectly. +* Updates Packages with new syntax versions +* Adds new handy flags to the `syncat` example + +## [Version 1.7.0](https://github.com/trishume/syntect/compare/v1.6.0...v1.7.0) (2017-06-30) + +> Pure Rust dump loading / creation features + +## [Version 1.6.0](https://github.com/trishume/syntect/compare/v1.5.0...v1.6.0) (2017-06-21) + +> Helper methods and more theme attributes + +## [Version 1.5.0](https://github.com/trishume/syntect/compare/v1.4.0...v1.5.0) (2017-05-31) + +> Highlighting stacks + +Small release, adds a convenience method for highlighting an entire stack, and derives some more things on `Scope`. + +## [Version 1.4.0](https://github.com/trishume/syntect/compare/v1.3.0...v1.4.0) (2017-05-25) + +> Serde and optional parsing + +This release switches the dump format from `rustc-serialize` to `Serde`, anyone using custom dumps will have to update them. + +It also makes the parsing part of the library optional behind a feature flag, anyone not using the default feature flags probably will want to add the `parsing` flag. + +## [Version 1.3.0](https://github.com/trishume/syntect/tree/v1.3.0) (2017-04-05) + +> Bug fixes, tests, updates and feature flags -See the Github release notes: +* Syntax tests: there is a new `syntest` example for running Sublime Text syntax tests +* Bug fixes: there's a ton of bugs fixed in this release, mostly found via the syntax tests. These mostly affected certain syntaxes which pushed/set multiple contexts at once. +* Updated packages: The Sublime packages have been updated to the latest version +* Feature flags: there's now Cargo feature flags for disabling some parts of syntect if you don't want unnecessary binary and dependency bloat. From 5cad57db86f8ec3b03437a02fbb1ec76ab794ad2 Mon Sep 17 00:00:00 2001 From: Johannes Rappen Date: Mon, 27 Jan 2020 21:31:32 +0100 Subject: [PATCH 2/7] chore: Remove trailing spaces --- src/parsing/syntax_set.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/parsing/syntax_set.rs b/src/parsing/syntax_set.rs index cd7af2b5..696e7662 100644 --- a/src/parsing/syntax_set.rs +++ b/src/parsing/syntax_set.rs @@ -148,7 +148,7 @@ impl SyntaxSet { pub fn set_metadata(&mut self, metadata: Metadata) { self.metadata = metadata; } - + /// The loaded metadata for this set. #[cfg(feature = "metadata")] pub fn metadata(&self) -> &Metadata { @@ -819,7 +819,7 @@ mod tests { let mut builder = SyntaxSetBuilder::new(); builder.add(syntax_a()); builder.add(syntax_b()); - + let syntax_a2 = SyntaxDefinition::load_from_str(r#" name: A improved scope: source.a @@ -834,7 +834,7 @@ mod tests { "#, true, None).unwrap(); builder.add(syntax_a2); - + let syntax_c = SyntaxDefinition::load_from_str(r#" name: C scope: source.c @@ -849,7 +849,7 @@ mod tests { "#, true, None).unwrap(); builder.add(syntax_c); - + builder.build() }; @@ -859,7 +859,7 @@ mod tests { assert_eq!(syntax.name, "A improved"); syntax = syntax_set.find_syntax_by_first_line(&"syntax a").unwrap(); assert_eq!(syntax.name, "C"); - + let mut parse_state = ParseState::new(syntax); let ops = parse_state.parse_line("c go_a a", &syntax_set); let expected = (7, ScopeStackOp::Push(Scope::new("a2").unwrap())); From f35d753636c9fe591598d0e551df039b6140fa41 Mon Sep 17 00:00:00 2001 From: Johannes Rappen Date: Mon, 27 Jan 2020 21:46:25 +0100 Subject: [PATCH 3/7] chore: Enhance readability of docs --- DESIGN.md | 19 +++++++----- Readme.md | 93 ++++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 77 insertions(+), 35 deletions(-) diff --git a/DESIGN.md b/DESIGN.md index 05dea1ac..b0937e5f 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -5,6 +5,7 @@ This is my scratch pad for optimization ideas. Some of this I will implement, so # Scopes ## Representation ideas: + - Normal arrays of strings - array of 32-bit or 64-bit atoms (maybe using Servo's atom library) - Atoms packed into one or two u64s @@ -13,6 +14,7 @@ This is my scratch pad for optimization ideas. Some of this I will implement, so - needs unsafe code ## Potential packings: + - variable width atoms, either 7 bits and a tag bit for top 128 or 13 bits and 3 tagging bits for rest - can fit all but 33 of the scopes present - tagged pointer (taking advantage of alignment), either a pointer to a slow path, or the first 4 bits set then a packed representation, one of others mentioned @@ -20,6 +22,7 @@ This is my scratch pad for optimization ideas. Some of this I will implement, so - 5 11-bit atoms and one 8-bit one for the first atom (2^11 = 2048, 2^8 = 256), one remaining bit for tag marker ## Stats: + - 7000 scopes referenced in sublime, 3537 unique ones, all stats after this are based on non-unique data - all but 33 scopes in default packages could fit in 64 with combination 8bit or 16bit atom encoding - there are only 1219 unique atoms in the default package set @@ -36,7 +39,7 @@ operation: `fn extent_matched(potential_prefix: Scope, s: Scope) -> u8` idea: any differences are beyond the length of the prefix. figure this out by xor and then ctz/clz then a compare to the length (however that works). -``` +```bash XXXXYYYY00000000 # prefix XXXXYYYYZZZZ0000 # testee 00000000ZZZZ0000 # = xored @@ -52,12 +55,12 @@ XXXXYYYYZZZZ0000 # testee # Parsing -Problem: need to reduce number of regex search calls -Solution: cache better +* Problem: need to reduce number of regex search calls +* Solution: cache better ## Stats -``` +```bash # On stats branch $cargo run --release --example syncat testdata/jquery.js | grep cmiss | wc -l Running `target/release/examples/syncat testdata/jquery.js` @@ -103,15 +106,17 @@ $cargo run --example syncat testdata/jquery.js | grep regsearch | wc -l Average unique regexes per line is 87.58, average non-unique is regsearch/lines = 317 -Ideally we should have only a couple fresh cache searches per line, not ~10 like the stats show (freshcachetoken/linecount). -In a fantabulous world these stats mean a possible 10x speed improvement, but since caching does have a cost and we can't always -cache it likely will be nice but not that high. +Ideally we should have only a couple fresh cache searches per line, not `~10` like the stats show (freshcachetoken/linecount). + +In a fantabulous world these stats mean a possible 10x speed improvement, but since caching does have a cost and we can't always cache it likely will be nice but not that high. ## Issues + - Stack transitions always bust cache, even when for example JS just pushes another group - Doesn't cache actual matches, only if it matched or not ## Attacks + - cache based on actual context, only search if it is a prototype we haven't searched before - hash maps based on casting RC ref to pointer and hashing? (there is a Hash impl for pointers) - for new searches, store matched regexes for context in BTreeMap like textmate diff --git a/Readme.md b/Readme.md index 936309ee..7f3db07b 100644 --- a/Readme.md +++ b/Readme.md @@ -1,13 +1,17 @@ # syntect + [![Crates.io](https://img.shields.io/crates/v/syntect.svg?maxAge=2591000)](https://crates.io/crates/syntect) [![Documentation](https://docs.rs/syntect/badge.svg)](https://docs.rs/syntect) [![Crates.io](https://img.shields.io/crates/l/syntect.svg?maxAge=2591000)]() [![Build Status](https://travis-ci.org/trishume/syntect.svg?branch=master)](https://travis-ci.org/trishume/syntect) [![codecov](https://codecov.io/gh/trishume/syntect/branch/master/graph/badge.svg)](https://codecov.io/gh/trishume/syntect) -`syntect` is a syntax highlighting library for Rust that uses [Sublime Text syntax definitions](http://www.sublimetext.com/docs/3/syntax.html#include-syntax). It aims to be a good solution for any Rust project that needs syntax highlighting, including deep integration with text editors written in Rust. It's used in production by at least two companies, and by [many open source projects](#projects-using-syntect). +`syntect` is a syntax highlighting library for Rust that uses [Sublime Text syntax definitions](http://www.sublimetext.com/docs/3/syntax.html#include-syntax). +It aims to be a good solution for any Rust project that needs syntax highlighting, including deep integration with text editors written in Rust. +It's used in production by at least two companies, and by [many open source projects](#projects-using-syntect). -If you are writing a text editor (or something else needing highlighting) in Rust and this library doesn't fit your needs, I consider that a bug and you should file an issue or email me. I consider this project mostly complete, I still maintain it and review PRs, but it's not under heavy development. +If you are writing a text editor (or something else needing highlighting) in Rust and this library doesn't fit your needs, I consider that a bug and you should file an issue or email me. +I consider this project mostly complete, I still maintain it and review PRs, but it's not under heavy development. ## Important Links @@ -26,7 +30,7 @@ After that take a look at the [documentation](https://docs.rs/syntect) and the [ If you've cloned this repository, be sure to run -``` +```bash git submodule update --init ``` @@ -48,7 +52,9 @@ to fetch all the required dependencies for running the tests. ## Screenshots -There's currently an example program called `syncat` that prints one of the source files using hard-coded themes and syntaxes using 24-bit terminal escape sequences supported by many newer terminals. These screenshots don't look as good as they could for two reasons: first the sRGB colours aren't corrected properly, and second the Rust syntax definition uses some fancy labels that these themes don't have highlighting for. +There's currently an example program called `syncat` that prints one of the source files using hard-coded themes and syntaxes using 24-bit terminal escape sequences supported by many newer terminals. +These screenshots don't look as good as they could for two reasons: +first the sRGB colours aren't corrected properly, and second the Rust syntax definition uses some fancy labels that these themes don't have highlighting for. ![Nested languages](http://i.imgur.com/bByxb1E.png) ![Base 16 Ocean Dark](http://i.imgur.com/CwiPOwZ.png) @@ -57,7 +63,8 @@ There's currently an example program called `syncat` that prints one of the sour ## Example Code -Prints highlighted lines of a string to the terminal. See the [easy](https://docs.rs/syntect/latest/syntect/easy/index.html) and [html](https://docs.rs/syntect/latest/syntect/html/index.html) module docs for more basic use case examples. +Prints highlighted lines of a string to the terminal. +See the [easy](https://docs.rs/syntect/latest/syntect/easy/index.html) and [html](https://docs.rs/syntect/latest/syntect/html/index.html) module docs for more basic use case examples. ```rust use syntect::easy::HighlightLines; @@ -92,24 +99,29 @@ Currently `syntect` is one of the faster syntax highlighting engines, but not th - [ ] Use a better regex engine, perhaps the in progress fancy-regex crate - [ ] Parallelize the highlighting. Is this even possible? Would it help? To be determined. -The current perf numbers are below. These numbers may get better if more of the things above are implemented, but they're better than many other text editors. +The current perf numbers are below. +These numbers may get better if more of the things above are implemented, but they're better than many other text editors. All measurements were taken on a mid 2012 15" retina Macbook Pro. - Highlighting 9200 lines/247kb of jQuery 2.1 takes 600ms. For comparison: - Textmate 2, Spacemacs and Visual Studio Code all take around 2ish seconds (measured by hand with a stopwatch, hence approximate). - Atom takes 6 seconds - - Sublime Text 3 dev build takes 98ms (highlighting only, takes ~200ms click to pixels), despite having a super fancy javascript syntax definition. - - Vim is instantaneous but that isn't a fair comparison since vim's highlighting is far more basic than the other editors (Compare [vim's grammar](https://github.com/vim/vim/blob/master/runtime/syntax/javascript.vim) to [Sublime's](https://github.com/sublimehq/Packages/blob/master/JavaScript/JavaScript.sublime-syntax)). + - Sublime Text 3 dev build takes `98ms` (highlighting only, takes `~200ms` click to pixels), despite having a super fancy javascript syntax definition. + - Vim is instantaneous but that isn't a fair comparison since vim's highlighting is far more basic than the other editors. + Compare [vim's grammar](https://github.com/vim/vim/blob/master/runtime/syntax/javascript.vim) to [Sublime's](https://github.com/sublimehq/Packages/blob/master/JavaScript/JavaScript.sublime-syntax). - These comparisons aren't totally fair, except the one to Sublime Text since that is using the same theme and the same complex definition for ES6 syntax. -- Simple syntaxes are faster, JS is one of the most complex. It only takes 34ms to highlight a 1700 line 62kb XML file or 50,000 lines/sec. -- ~138ms to load and link all the syntax definitions in the default Sublime package set. - - but only ~23ms to load and link all the syntax definitions from an internal pre-made binary dump with lazy regex compilation. -- ~1.9ms to parse and highlight the 30 line 791 character `testdata/highlight_test.erb` file. This works out to around 16,000 lines/second or 422 kilobytes/second. -- ~250ms end to end for `syncat` to start, load the definitions, highlight the test file and shut down. This is mostly spent loading. +- Simple syntaxes are faster, JS is one of the most complex. + It only takes 34ms to highlight a 1700 line 62kb XML file or 50,000 lines/sec. +- `~138ms` to load and link all the syntax definitions in the default Sublime package set. + - but only `~23ms` to load and link all the syntax definitions from an internal pre-made binary dump with lazy regex compilation. +- `~1.9ms` to parse and highlight the 30 line 791 character `testdata/highlight_test.erb` file. This works out to around 16,000 lines/second or 422 kilobytes/second. +- `~250ms` end to end for `syncat` to start, load the definitions, highlight the test file and shut down. + This is mostly spent loading. ## Feature Flags -Syntect makes heavy use of [cargo features](http://doc.crates.io/manifest.html#the-features-section), to support users who require only a subset of functionality. In particular, it is possible to use the highlighting component of syntect without the parser (for instance when hand-rolling a higher performance parser for a particular language), by adding `default-features = false` to the syntect entry in your `Cargo.toml`. +Syntect makes heavy use of [cargo features](http://doc.crates.io/manifest.html#the-features-section), to support users who require only a subset of functionality. +In particular, it is possible to use the highlighting component of syntect without the parser (for instance when hand-rolling a higher performance parser for a particular language), by adding `default-features = false` to the syntect entry in your `Cargo.toml`. For more information on available features, see the features section in `Cargo.toml`. @@ -117,34 +129,57 @@ For more information on available features, see the features section in `Cargo.t Because `syntect`'s API exposes internal cacheable data structures, there is a caching strategy that text editors can use that allows the text on screen to be re-rendered instantaneously regardless of the file size when a change is made after the initial highlight. -Basically, on the initial parse every 1000 lines or so copy the parse state into a side-buffer for that line. When a change is made to the text, because of the way Sublime Text grammars work (and languages in general), only the highlighting after that change can be affected. Thus when a change is made to the text, search backwards in the parse state cache for the last state before the edit, then kick off a background task to start re-highlighting from there. Once the background task highlights past the end of the current editor viewport, render the new changes and continue re-highlighting the rest of the file in the background. +Basically, on the initial parse every 1000 lines or so copy the parse state into a side-buffer for that line. +When a change is made to the text, because of the way Sublime Text grammars work (and languages in general), only the highlighting after that change can be affected. +Thus when a change is made to the text, search backwards in the parse state cache for the last state before the edit, then kick off a background task to start re-highlighting from there. +Once the background task highlights past the end of the current editor viewport, render the new changes and continue re-highlighting the rest of the file in the background. -This way from the time the edit happens to the time the new colouring gets rendered in the worst case only `999+length of viewport` lines must be re-highlighted. Given the speed of `syntect` even with a long file and the most complicated syntax and theme this should take less than 100ms. This is enough to re-highlight on every key-stroke of the world's fastest typist *in the worst possible case*. And you can reduce this asymptotically to the length of the viewport by caching parse states more often, at the cost of more memory. +This way from the time the edit happens to the time the new colouring gets rendered in the worst case only `999+length of viewport` lines must be re-highlighted. +Given the speed of `syntect` even with a long file and the most complicated syntax and theme this should take less than 100ms. +This is enough to re-highlight on every key-stroke of the world's fastest typist *in the worst possible case*. +And you can reduce this asymptotically to the length of the viewport by caching parse states more often, at the cost of more memory. -Any time the file is changed the latest cached state is found, the cache is cleared after that point, and a background job is started. Any already running jobs are stopped because they would be working on old state. This way you can just have one thread dedicated to highlighting that is always doing the most up-to-date work, or sleeping. +Any time the file is changed the latest cached state is found, the cache is cleared after that point, and a background job is started. +Any already running jobs are stopped because they would be working on old state. This way you can just have one thread dedicated to highlighting that is always doing the most up-to-date work, or sleeping. ## Parallelizing -Since 3.0, `syntect` can be used to do parsing/highlighting in parallel. `SyntaxSet` is both `Send` and `Sync` and so can easily be used from multiple threads. It is also `Clone`, which means you can construct a syntax set and then clone it to use for other threads if you prefer. +Since 3.0, `syntect` can be used to do parsing/highlighting in parallel. +`SyntaxSet` is both `Send` and `Sync` and so can easily be used from multiple threads. +It is also `Clone`, which means you can construct a syntax set and then clone it to use for other threads if you prefer. -Compared to older versions, there's nothing preventing the serialization of a `SyntaxSet` either. So you can directly deserialize a fully linked `SyntaxSet` and start using it for parsing/highlighting. Before, it was always necessary to do linking first. +Compared to older versions, there's nothing preventing the serialization of a `SyntaxSet` either. +So you can directly deserialize a fully linked `SyntaxSet` and start using it for parsing/highlighting. +Before, it was always necessary to do linking first. -It is worth mentioning that regex compilation is done lazily only when the regexes are actually needed. Once a regex has been compiled, the compiled version is used for all threads after that. Note that this is done using interior mutability, so if multiple threads happen to encounter the same uncompiled regex at the same time, compiling might happen multiple times. After that, one of the compiled regexes will be used. When a `SyntaxSet` is cloned, the regexes in the cloned set will need to be recompiled currently. +It is worth mentioning that regex compilation is done lazily only when the regexes are actually needed. +Once a regex has been compiled, the compiled version is used for all threads after that. +Note that this is done using interior mutability, so if multiple threads happen to encounter the same uncompiled regex at the same time, compiling might happen multiple times. +After that, one of the compiled regexes will be used. +When a `SyntaxSet` is cloned, the regexes in the cloned set will need to be recompiled currently. -For adding parallelism to a previously single-threaded program, the recommended thread pooling is [`rayon`](https://github.com/nikomatsakis/rayon). However, if you're working in an already-threaded context where there might be more threads than you want (such as writing a handler for an Iron request), the recommendation is to force all highlighting to be done within a fixed-size thread pool using [`rust-scoped-pool`](https://github.com/reem/rust-scoped-pool). An example of the former is in `examples/parsyncat.rs`. +For adding parallelism to a previously single-threaded program, the recommended thread pooling is [`rayon`](https://github.com/nikomatsakis/rayon). +However, if you're working in an already-threaded context where there might be more threads than you want (such as writing a handler for an Iron request), the recommendation is to force all highlighting to be done within a fixed-size thread pool using [`rust-scoped-pool`](https://github.com/reem/rust-scoped-pool). +An example of the former is in `examples/parsyncat.rs`. ## Examples Available There's a number of examples of programs that use `syntect` in the `examples` folder and some code outside the repo: -- `syncat` prints a highlighted file to the terminal using 24-bit colour ANSI escape codes. It demonstrates a simple file highlighting workflow. -- `synhtml` prints an HTML file that will display the highlighted code. Demonstrates how syntect could be used by web servers and static site generators. -- `synstats` collects a bunch of statistics about the code in a folder. Includes basic things like line count but also fancier things like number of functions. Demonstrates how `syntect` can be used for code analysis as well as highlighting, as well as how to use the APIs to parse out the semantic tokenization. +- `syncat` prints a highlighted file to the terminal using 24-bit colour ANSI escape codes. + It demonstrates a simple file highlighting workflow. +- `synhtml` prints an HTML file that will display the highlighted code. + Demonstrates how syntect could be used by web servers and static site generators. +- `synstats` collects a bunch of statistics about the code in a folder. + Includes basic things like line count but also fancier things like number of functions. + Demonstrates how `syntect` can be used for code analysis as well as highlighting, as well as how to use the APIs to parse out the semantic tokenization. - [`faiyels`](https://github.com/trishume/faiyels) is a little code minimap visualizer I wrote that uses `syntect` for highlighting. -- `parsyncat` is like `syncat`, but accepts multiple files and highlights them in parallel. It demonstrates how to use `syntect` from multiple threads. +- `parsyncat` is like `syncat`, but accepts multiple files and highlights them in parallel. + It demonstrates how to use `syntect` from multiple threads. Here's that stats that `synstats` extracts from `syntect`'s codebase (not including examples and test data) as of [this commit](https://github.com/trishume/syntect/commit/10baa6888f84ea4ae35c746526302a8ff4956eb1): -``` + +```text ################## Stats ################### File count: 19 Total characters: 155504 @@ -183,6 +218,8 @@ Below is a list of projects using Syntect, in approximate order by how long they ## License and Acknowledgements -Thanks to [Robin Stocker](https://github.com/robinst) and also [Keith Hall](https://github.com/keith-hall) for making awesome substantial contributions of the most important impressive improvements `syntect` has had post-`v1.0`! They deserve lots of credit for where `syntect` is today. +Thanks to [Robin Stocker](https://github.com/robinst) and also [Keith Hall](https://github.com/keith-hall) for making awesome substantial contributions of the most important impressive improvements `syntect` has had post-`v1.0`! +They deserve lots of credit for where `syntect` is today. -Thanks to [Textmate 2](https://github.com/textmate/textmate) and @defuz's [sublimate](https://github.com/defuz/sublimate) for the existing open source code I used as inspiration and in the case of sublimate's `tmTheme` loader, copy-pasted. All code (including defuz's sublimate code) is released under the MIT license. +Thanks to [Textmate 2](https://github.com/textmate/textmate) and @defuz's [sublimate](https://github.com/defuz/sublimate) for the existing open source code I used as inspiration and in the case of sublimate's `tmTheme` loader, copy-pasted. +All code (including defuz's sublimate code) is released under the MIT license. From a9f0f9fa0cdd45abf4d12cb20f8fe91b7fca6e85 Mon Sep 17 00:00:00 2001 From: Johannes Rappen Date: Mon, 27 Jan 2020 22:28:06 +0100 Subject: [PATCH 4/7] chore: Update git files to be more verbose --- .gitattributes | 33 ++++++++++++++++++++++++++++++++- .gitignore | 13 ++++++++++--- 2 files changed, 42 insertions(+), 4 deletions(-) diff --git a/.gitattributes b/.gitattributes index 0cc26ec0..1ca91335 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,32 @@ -testdata/* linguist-vendored +# Sublime Text + +# tabs indentation, no trailing +*.stTheme eol=lf whitespace=-tab-in-indent,trailing-space,tabwidth=4 # XML / PLIST +# spaces indentation, no trailing +*.sublime-color-scheme eol=lf whitespace=tab-in-indent,trailing-space,tabwidth=4 # JSONC +*.hidden-color-scheme eol=lf whitespace=tab-in-indent,trailing-space,tabwidth=4 # JSONC +*.sublime-settings eol=lf whitespace=tab-in-indent,trailing-space,tabwidth=4 # JSONC +*.sublime-syntax eol=lf whitespace=tab-in-indent,trailing-space,tabwidth=2 # YAML +*.sublime-theme eol=lf whitespace=tab-in-indent,trailing-space,tabwidth=4 # JSONC + +# TextMate + +# tabs indentation, no trailing +*.tmLanguage eol=lf whitespace=-tab-in-indent,trailing-space,tabwidth=4 # XML / PLIST +*.hidden-tmLanguage eol=lf whitespace=-tab-in-indent,trailing-space,tabwidth=4 # XML / PLIST +*.tmPreferences eol=lf whitespace=-tab-in-indent,trailing-space,tabwidth=4 # XML / PLIST +*.tmTheme eol=lf whitespace=-tab-in-indent,trailing-space,tabwidth=4 # XML / PLIST +*.hidden-tmTheme eol=lf whitespace=-tab-in-indent,trailing-space,tabwidth=4 # XML / PLIST + +# syntect + +testdata/* linguist-vendored + +# General + +# spaces indentation, no trailing +*.md eol=lf whitespace=tab-in-indent,trailing-space,tabwidth=4 +# binary +*.png binary +*.tex diff=tex +*.pdf binary diff=astextplain diff --git a/.gitignore b/.gitignore index 14d5f023..dfd14d84 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,10 @@ +# macOS +.DS_Store +Thumbs.db + +# Windows +[Dd]esktop.ini + # cargo target/ Cargo.lock @@ -6,8 +13,8 @@ Cargo.lock .idea/ *.iml +# Sublime Text +*.sublime-workspace + # VS Code .vscode/ - -# macOS -.DS_Store From 30158277c57e7c44e45112dc73db524683443e6e Mon Sep 17 00:00:00 2001 From: Johannes Rappen Date: Tue, 28 Jan 2020 15:49:16 +0100 Subject: [PATCH 5/7] feat: Prepare for supporting named CSS colors --- src/highlighting/style.rs | 857 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 857 insertions(+) diff --git a/src/highlighting/style.rs b/src/highlighting/style.rs index 08a0aec1..b7212f72 100644 --- a/src/highlighting/style.rs +++ b/src/highlighting/style.rs @@ -70,6 +70,863 @@ impl Color { b: 0xFF, a: 0xFF, }; + + /// Red CSS colors ///////////////////////////////////////////////////////// + pub const LIGHTSALMON: Color = Color { + r: 0xFF, + g: 0xA0, + b: 0x7A, + a: 0xFF, + }; + pub const SALMON: Color = Color { + r: 0xFA, + g: 0x80, + b: 0x72, + a: 0xFF, + }; + pub const DARKSALMON: Color = Color { + r: 0xE9, + g: 0x96, + b: 0x7A, + a: 0xFF, + }; + pub const LIGHTCORAL: Color = Color { + r: 0xF0, + g: 0x80, + b: 0x80, + a: 0xFF, + }; + pub const INDIANRED: Color = Color { + r: 0xCD, + g: 0x5C, + b: 0x5C, + a: 0xFF, + }; + pub const CRIMSON: Color = Color { + r: 0xDC, + g: 0x14, + b: 0x3C, + a: 0xFF, + }; + pub const FIREBRICK: Color = Color { + r: 0xB2, + g: 0x22, + b: 0x22, + a: 0xFF, + }; + pub const RED: Color = Color { + r: 0xFF, + g: 0x00, + b: 0x00, + a: 0xFF, + }; + pub const DARKRED: Color = Color { + r: 0x8B, + g: 0x00, + b: 0x00, + a: 0xFF, + }; + + /// Orange CSS colors ////////////////////////////////////////////////////// + pub const CORAL: Color = Color { + r: 0xFF, + g: 0x7F, + b: 0x50, + a: 0xFF, + }; + pub const TOMATO: Color = Color { + r: 0xFF, + g: 0x63, + b: 0x47, + a: 0xFF, + }; + pub const ORANGERED: Color = Color { + r: 0xFF, + g: 0x45, + b: 0x00, + a: 0xFF, + }; + pub const GOLD: Color = Color { + r: 0xFF, + g: 0xD7, + b: 0x00, + a: 0xFF, + }; + pub const ORANGE: Color = Color { + r: 0xFF, + g: 0xA5, + b: 0x00, + a: 0xFF, + }; + pub const DARKORANGE: Color = Color { + r: 0xFF, + g: 0x8C, + b: 0x00, + a: 0xFF, + }; + + /// Yellow CSS colors ////////////////////////////////////////////////////// + pub const LIGHTYELLOW: Color = Color { + r: 0xFF, + g: 0xFF, + b: 0xE0, + a: 0xFF, + }; + pub const LEMONCHIFFON: Color = Color { + r: 0xFF, + g: 0xFA, + b: 0xCD, + a: 0xFF, + }; + pub const LIGHTGOLDENRODYELLOW: Color = Color { + r: 0xFA, + g: 0xFA, + b: 0xD2, + a: 0xFF, + }; + pub const PAPAYAWHIP: Color = Color { + r: 0xFF, + g: 0xEF, + b: 0xD5, + a: 0xFF, + }; + pub const MOCCASIN: Color = Color { + r: 0xFF, + g: 0xE4, + b: 0xB5, + a: 0xFF, + }; + pub const PEACHPUFF: Color = Color { + r: 0xFF, + g: 0xDA, + b: 0xB9, + a: 0xFF, + }; + pub const PALEGOLDENROD: Color = Color { + r: 0xEE, + g: 0xE8, + b: 0xAA, + a: 0xFF, + }; + pub const KHAKI: Color = Color { + r: 0xF0, + g: 0xE6, + b: 0x8C, + a: 0xFF, + }; + pub const DARKKHAKI: Color = Color { + r: 0xBD, + g: 0xB7, + b: 0x6B, + a: 0xFF, + }; + pub const YELLOW: Color = Color { + r: 0xFF, + g: 0xFF, + b: 0x00, + a: 0xFF, + }; + + + /// Green CSS colors /////////////////////////////////////////////////////// + pub const LAWNGREEN: Color = Color { + r: 0x7C, + g: 0xFC, + b: 0x00, + a: 0xFF, + }; + pub const CHARTREUSE: Color = Color { + r: 0x7F, + g: 0xFF, + b: 0x00, + a: 0xFF, + }; + pub const LIMEGREEN: Color = Color { + r: 0x32, + g: 0xCD, + b: 0x32, + a: 0xFF, + }; + pub const LIME: Color = Color { + r: 0x00, + g: 0xFF, + b: 0x00, + a: 0xFF, + }; + pub const FORESTGREEN: Color = Color { + r: 0x22, + g: 0x8B, + b: 0x22, + a: 0xFF, + }; + pub const GREEN: Color = Color { + r: 0x00, + g: 0x80, + b: 0x00, + a: 0xFF, + }; + pub const DARKGREEN: Color = Color { + r: 0x00, + g: 0x64, + b: 0x00, + a: 0xFF, + }; + pub const GREENYELLOW: Color = Color { + r: 0xAD, + g: 0xFF, + b: 0x2F, + a: 0xFF, + }; + pub const YELLOWGREEN: Color = Color { + r: 0x9A, + g: 0xCD, + b: 0x32, + a: 0xFF, + }; + pub const SPRINGGREEN: Color = Color { + r: 0x00, + g: 0xFF, + b: 0x7F, + a: 0xFF, + }; + pub const MEDIUMSPINGGREEN: Color = Color { + r: 0x00, + g: 0xFA, + b: 0x9A, + a: 0xFF, + }; + pub const LIGHTGREEN: Color = Color { + r: 0x90, + g: 0xEE, + b: 0x90, + a: 0xFF, + }; + pub const PALEGREEN: Color = Color { + r: 0x98, + g: 0xFB, + b: 0x98, + a: 0xFF, + }; + pub const DARKSEAGREEN: Color = Color { + r: 0x8F, + g: 0xBC, + b: 0x8F, + a: 0xFF, + }; + pub const MEDIUMSEAGREEN: Color = Color { + r: 0x3C, + g: 0xB3, + b: 0x71, + a: 0xFF, + }; + pub const SEAGREEN: Color = Color { + r: 0x2E, + g: 0x8B, + b: 0x57, + a: 0xFF, + }; + pub const OLIVE: Color = Color { + r: 0x80, + g: 0x80, + b: 0x00, + a: 0xFF, + }; + pub const DARKOLIVE: Color = Color { + r: 0x55, + g: 0x6B, + b: 0x2F, + a: 0xFF, + }; + pub const OLIVEDRAB: Color = Color { + r: 0x6B, + g: 0x8E, + b: 0x23, + a: 0xFF, + }; + + /// Cyan CSS colors //////////////////////////////////////////////////////// + pub const LIGHTCYAN: Color = Color { + r: 0xE0, + g: 0xFF, + b: 0xFF, + a: 0xFF, + }; + pub const CYAN: Color = Color { + r: 0x00, + g: 0xFF, + b: 0xFF, + a: 0xFF, + }; + pub const AQUA: Color = Color { + r: 0xE0, + g: 0xFF, + b: 0xFF, + a: 0xFF, + }; + pub const AQUAMARINE: Color = Color { + r: 0x7F, + g: 0xFF, + b: 0xD4, + a: 0xFF, + }; + pub const MEDIUMAQUAMARINE: Color = Color { + r: 0x66, + g: 0xCD, + b: 0xAA, + a: 0xFF, + }; + pub const PALETURQUOISE: Color = Color { + r: 0xAF, + g: 0xEE, + b: 0xEE, + a: 0xFF, + }; + pub const TURQUOISE: Color = Color { + r: 0x40, + g: 0xE0, + b: 0xD0, + a: 0xFF, + }; + pub const MEDIUMTURQUOISE: Color = Color { + r: 0x48, + g: 0xD1, + b: 0xCC, + a: 0xFF, + }; + pub const DARKTURQUOISE: Color = Color { + r: 0x00, + g: 0xCE, + b: 0xD1, + a: 0xFF, + }; + pub const LIGHTSEAGREEN: Color = Color { + r: 0x20, + g: 0xB2, + b: 0xAA, + a: 0xFF, + }; + pub const CADETBLUE: Color = Color { + r: 0x5F, + g: 0x9E, + b: 0xA0, + a: 0xFF, + }; + pub const DARKCYAN: Color = Color { + r: 0x00, + g: 0x8B, + b: 0x8B, + a: 0xFF, + }; + pub const TEAL: Color = Color { + r: 0x00, + g: 0x80, + b: 0x80, + a: 0xFF, + }; + + /// Blue CSS colors //////////////////////////////////////////////////////// + pub const POWDERBLUE: Color = Color { + r: 0xB0, + g: 0xE0, + b: 0xE6, + a: 0xFF, + }; + pub const LIGHTBLUE: Color = Color { + r: 0xAD, + g: 0xD8, + b: 0xE6, + a: 0xFF, + }; + pub const LIGHTSKYBLUE: Color = Color { + r: 0x87, + g: 0xCE, + b: 0xFA, + a: 0xFF, + }; + pub const SKYBLUE: Color = Color { + r: 0x87, + g: 0xCE, + b: 0xEB, + a: 0xFF, + }; + pub const DEEPSKYBLUE: Color = Color { + r: 0x00, + g: 0xBF, + b: 0xFF, + a: 0xFF, + }; + pub const LIGHTSTEELBLUE: Color = Color { + r: 0xB0, + g: 0xC4, + b: 0xDE, + a: 0xFF, + }; + pub const DODGERBLUE: Color = Color { + r: 0x1E, + g: 0x90, + b: 0xFF, + a: 0xFF, + }; + pub const CORNFLOWERBLUE: Color = Color { + r: 0x64, + g: 0x95, + b: 0xED, + a: 0xFF, + }; + pub const STEELBLUE: Color = Color { + r: 0x46, + g: 0x82, + b: 0xB4, + a: 0xFF, + }; + pub const ROYALBLUE: Color = Color { + r: 0x41, + g: 0x69, + b: 0xE1, + a: 0xFF, + }; + pub const BLUE: Color = Color { + r: 0x00, + g: 0x00, + b: 0xFF, + a: 0xFF, + }; + pub const MEDIUMBLUE: Color = Color { + r: 0x00, + g: 0x00, + b: 0xCD, + a: 0xFF, + }; + pub const DARKBLUE: Color = Color { + r: 0x00, + g: 0x00, + b: 0x8B, + a: 0xFF, + }; + pub const NAVY: Color = Color { + r: 0x00, + g: 0x00, + b: 0x80, + a: 0xFF, + }; + pub const MIDNIGHTBLUE: Color = Color { + r: 0x19, + g: 0x19, + b: 0x70, + a: 0xFF, + }; + pub const MEDIUMSLATEBLUE: Color = Color { + r: 0x7B, + g: 0x68, + b: 0xEE, + a: 0xFF, + }; + pub const SLATEBLUE: Color = Color { + r: 0x6A, + g: 0x5A, + b: 0xCD, + a: 0xFF, + }; + pub const DARKSLATEBLUE: Color = Color { + r: 0x48, + g: 0x3D, + b: 0x8B, + a: 0xFF, + }; + + /// Purple CSS colors ////////////////////////////////////////////////////// + pub const LAVENDER: Color = Color { + r: 0xE6, + g: 0xE6, + b: 0xFA, + a: 0xFF, + }; + pub const THISTLE: Color = Color { + r: 0xD8, + g: 0xBF, + b: 0xD8, + a: 0xFF, + }; + pub const PLUM: Color = Color { + r: 0xDD, + g: 0xA0, + b: 0xDD, + a: 0xFF, + }; + pub const VIOLET: Color = Color { + r: 0xEE, + g: 0x82, + b: 0xEE, + a: 0xFF, + }; + pub const ORCHID: Color = Color { + r: 0xDA, + g: 0x70, + b: 0xD6, + a: 0xFF, + }; + pub const FUCHSIA: Color = Color { + r: 0xFF, + g: 0x00, + b: 0xFF, + a: 0xFF, + }; + pub const MAGENTA: Color = Color { + r: 0xFF, + g: 0x00, + b: 0xFF, + a: 0xFF, + }; + pub const MEDIUMORCHID: Color = Color { + r: 0xBA, + g: 0x55, + b: 0xD3, + a: 0xFF, + }; + pub const MEDIUMPURPLE: Color = Color { + r: 0x93, + g: 0x70, + b: 0xDB, + a: 0xFF, + }; + pub const BLUEVIOLET: Color = Color { + r: 0x8A, + g: 0x2B, + b: 0xE2, + a: 0xFF, + }; + pub const DARKVIOLET: Color = Color { + r: 0x94, + g: 0x00, + b: 0xD3, + a: 0xFF, + }; + pub const DARKORCHID: Color = Color { + r: 0x99, + g: 0x32, + b: 0xCC, + a: 0xFF, + }; + pub const DARKMAGENTA: Color = Color { + r: 0x8B, + g: 0x00, + b: 0x8B, + a: 0xFF, + }; + pub const PURPLE: Color = Color { + r: 0x80, + g: 0x00, + b: 0x80, + a: 0xFF, + }; + pub const INDIGO: Color = Color { + r: 0x4B, + g: 0x00, + b: 0x82, + a: 0xFF, + }; + + /// Pink CSS colors //////////////////////////////////////////////////////// + pub const PINK: Color = Color { + r: 0xFF, + g: 0xC0, + b: 0xCB, + a: 0xFF, + }; + pub const LIGHTPINK: Color = Color { + r: 0xFF, + g: 0xB6, + b: 0xC1, + a: 0xFF, + }; + pub const HOTPINK: Color = Color { + r: 0xFF, + g: 0x69, + b: 0xB4, + a: 0xFF, + }; + pub const DEEPPINK: Color = Color { + r: 0xFF, + g: 0x14, + b: 0x93, + a: 0xFF, + }; + pub const PALEVIOLETRED: Color = Color { + r: 0xDB, + g: 0x70, + b: 0x93, + a: 0xFF, + }; + pub const MEDIUMVIOLETRED: Color = Color { + r: 0xC7, + g: 0x15, + b: 0x85, + a: 0xFF, + }; + + /// White CSS colors /////////////////////////////////////////////////////// + pub const WHITE: Color = Color { + r: 0xFF, + g: 0xFF, + b: 0xFF, + a: 0xFF, + }; + pub const SNOW: Color = Color { + r: 0xFF, + g: 0xFA, + b: 0xFA, + a: 0xFF, + }; + pub const HONEYDEW: Color = Color { + r: 0xF0, + g: 0xFF, + b: 0xF0, + a: 0xFF, + }; + pub const MINTCREAM: Color = Color { + r: 0xF5, + g: 0xFF, + b: 0xFA, + a: 0xFF, + }; + pub const AZURE: Color = Color { + r: 0xF0, + g: 0xFF, + b: 0xFF, + a: 0xFF, + }; + pub const ALICEBLUE: Color = Color { + r: 0xF0, + g: 0xF8, + b: 0xFF, + a: 0xFF, + }; + pub const GHOSTWHITE: Color = Color { + r: 0xF8, + g: 0xF8, + b: 0xFF, + a: 0xFF, + }; + pub const WHITESMOKE: Color = Color { + r: 0xF5, + g: 0xF5, + b: 0xF5, + a: 0xFF, + }; + pub const SEASHELL: Color = Color { + r: 0xFF, + g: 0xF5, + b: 0xEE, + a: 0xFF, + }; + pub const BEIGE: Color = Color { + r: 0xF5, + g: 0xF5, + b: 0xDC, + a: 0xFF, + }; + pub const OLDLACE: Color = Color { + r: 0xFD, + g: 0xF5, + b: 0xE6, + a: 0xFF, + }; + pub const FLORALWHITE: Color = Color { + r: 0xFF, + g: 0xFA, + b: 0xF0, + a: 0xFF, + }; + pub const IVORY: Color = Color { + r: 0xFF, + g: 0xFF, + b: 0xF0, + a: 0xFF, + }; + pub const ANTIQUEWHITE: Color = Color { + r: 0xFA, + g: 0xEB, + b: 0xD7, + a: 0xFF, + }; + pub const LINEN: Color = Color { + r: 0xFA, + g: 0xF0, + b: 0xE6, + a: 0xFF, + }; + pub const LAVENDERBLUSH: Color = Color { + r: 0xFF, + g: 0xF0, + b: 0xF5, + a: 0xFF, + }; + pub const MISTYROSE: Color = Color { + r: 0xFF, + g: 0xE4, + b: 0xE1, + a: 0xFF, + }; + + /// Gray CSS colors //////////////////////////////////////////////////////// + pub const GAINSBORO: Color = Color { + r: 0xDC, + g: 0xDC, + b: 0xDC, + a: 0xFF, + }; + pub const LIGHTGRAY: Color = Color { + r: 0xD3, + g: 0xD3, + b: 0xD3, + a: 0xFF, + }; + pub const SILVER: Color = Color { + r: 0xC0, + g: 0xC0, + b: 0xC0, + a: 0xFF, + }; + pub const DARKGRAY: Color = Color { + r: 0xA9, + g: 0xA9, + b: 0xA9, + a: 0xFF, + }; + pub const GRAY: Color = Color { + r: 0x80, + g: 0x80, + b: 0x80, + a: 0xFF, + }; + pub const DIMGRAY: Color = Color { + r: 0x69, + g: 0x69, + b: 0x69, + a: 0xFF, + }; + pub const LIGHTSLATEGRAY: Color = Color { + r: 0x77, + g: 0x88, + b: 0x99, + a: 0xFF, + }; + pub const SLATEGRAY: Color = Color { + r: 0x70, + g: 0x80, + b: 0x90, + a: 0xFF, + }; + pub const DARKSLATEGRAY: Color = Color { + r: 0x2F, + g: 0x4F, + b: 0x4F, + a: 0xFF, + }; + pub const BLACK: Color = Color { + r: 0x00, + g: 0x00, + b: 0x00, + a: 0xFF, + }; + + /// Brown CSS colors /////////////////////////////////////////////////////// + pub const CORNSILK: Color = Color { + r: 0xFF, + g: 0xF8, + b: 0xDC, + a: 0xFF, + }; + pub const BLANCHEDALMOND: Color = Color { + r: 0xFF, + g: 0xEB, + b: 0xCD, + a: 0xFF, + }; + pub const BISQUE: Color = Color { + r: 0xFF, + g: 0xE4, + b: 0xC4, + a: 0xFF, + }; + pub const NAVAJOWHITE: Color = Color { + r: 0xFF, + g: 0xDE, + b: 0xAD, + a: 0xFF, + }; + pub const WHEAT: Color = Color { + r: 0xF5, + g: 0xDE, + b: 0xB3, + a: 0xFF, + }; + pub const BURLYWOOD: Color = Color { + r: 0xDE, + g: 0xB8, + b: 0x87, + a: 0xFF, + }; + pub const TAN: Color = Color { + r: 0xD2, + g: 0xB4, + b: 0x8C, + a: 0xFF, + }; + pub const ROSYBROWN: Color = Color { + r: 0xBC, + g: 0x8F, + b: 0x8F, + a: 0xFF, + }; + pub const SANDYBROWN: Color = Color { + r: 0xF4, + g: 0xA4, + b: 0x60, + a: 0xFF, + }; + pub const GOLDENROD: Color = Color { + r: 0xDA, + g: 0xA5, + b: 0x20, + a: 0xFF, + }; + pub const PERU: Color = Color { + r: 0xCD, + g: 0x85, + b: 0x3F, + a: 0xFF, + }; + pub const CHOCOLATE: Color = Color { + r: 0xD2, + g: 0x69, + b: 0x1E, + a: 0xFF, + }; + pub const SADDLEBROWN: Color = Color { + r: 0x8B, + g: 0x45, + b: 0x13, + a: 0xFF, + }; + pub const SIENNA: Color = Color { + r: 0xA0, + g: 0x52, + b: 0x2D, + a: 0xFF, + }; + pub const BROWN: Color = Color { + r: 0xA5, + g: 0x2A, + b: 0x2A, + a: 0xFF, + }; + pub const MAROON: Color = Color { + r: 0x80, + g: 0x00, + b: 0x00, + a: 0xFF, + }; } impl Style { From a1912c8b390e4e4993d408f07b0ca536979dbf65 Mon Sep 17 00:00:00 2001 From: Johannes Rappen Date: Tue, 28 Jan 2020 15:52:44 +0100 Subject: [PATCH 6/7] gitsubmodules: (temp.) target Packages st3 branch --- .gitmodules | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitmodules b/.gitmodules index e42197e5..dbf004ad 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,5 @@ [submodule "testdata/Packages"] + branch = st3 # TODO: this line should be removed once st4 functionality has been implemented path = testdata/Packages url = https://github.com/sublimehq/Packages [submodule "testdata/InspiredGitHub.tmtheme"] From 920202a7c1880a8c5a0ce394c34c467a2c1525d8 Mon Sep 17 00:00:00 2001 From: Johannes Rappen Date: Thu, 30 Jan 2020 12:04:27 +0100 Subject: [PATCH 7/7] revert 3015827 upon request reverting changes from 3015827 based on comment in trishume/syntect#279 --- src/highlighting/style.rs | 857 -------------------------------------- 1 file changed, 857 deletions(-) diff --git a/src/highlighting/style.rs b/src/highlighting/style.rs index b7212f72..08a0aec1 100644 --- a/src/highlighting/style.rs +++ b/src/highlighting/style.rs @@ -70,863 +70,6 @@ impl Color { b: 0xFF, a: 0xFF, }; - - /// Red CSS colors ///////////////////////////////////////////////////////// - pub const LIGHTSALMON: Color = Color { - r: 0xFF, - g: 0xA0, - b: 0x7A, - a: 0xFF, - }; - pub const SALMON: Color = Color { - r: 0xFA, - g: 0x80, - b: 0x72, - a: 0xFF, - }; - pub const DARKSALMON: Color = Color { - r: 0xE9, - g: 0x96, - b: 0x7A, - a: 0xFF, - }; - pub const LIGHTCORAL: Color = Color { - r: 0xF0, - g: 0x80, - b: 0x80, - a: 0xFF, - }; - pub const INDIANRED: Color = Color { - r: 0xCD, - g: 0x5C, - b: 0x5C, - a: 0xFF, - }; - pub const CRIMSON: Color = Color { - r: 0xDC, - g: 0x14, - b: 0x3C, - a: 0xFF, - }; - pub const FIREBRICK: Color = Color { - r: 0xB2, - g: 0x22, - b: 0x22, - a: 0xFF, - }; - pub const RED: Color = Color { - r: 0xFF, - g: 0x00, - b: 0x00, - a: 0xFF, - }; - pub const DARKRED: Color = Color { - r: 0x8B, - g: 0x00, - b: 0x00, - a: 0xFF, - }; - - /// Orange CSS colors ////////////////////////////////////////////////////// - pub const CORAL: Color = Color { - r: 0xFF, - g: 0x7F, - b: 0x50, - a: 0xFF, - }; - pub const TOMATO: Color = Color { - r: 0xFF, - g: 0x63, - b: 0x47, - a: 0xFF, - }; - pub const ORANGERED: Color = Color { - r: 0xFF, - g: 0x45, - b: 0x00, - a: 0xFF, - }; - pub const GOLD: Color = Color { - r: 0xFF, - g: 0xD7, - b: 0x00, - a: 0xFF, - }; - pub const ORANGE: Color = Color { - r: 0xFF, - g: 0xA5, - b: 0x00, - a: 0xFF, - }; - pub const DARKORANGE: Color = Color { - r: 0xFF, - g: 0x8C, - b: 0x00, - a: 0xFF, - }; - - /// Yellow CSS colors ////////////////////////////////////////////////////// - pub const LIGHTYELLOW: Color = Color { - r: 0xFF, - g: 0xFF, - b: 0xE0, - a: 0xFF, - }; - pub const LEMONCHIFFON: Color = Color { - r: 0xFF, - g: 0xFA, - b: 0xCD, - a: 0xFF, - }; - pub const LIGHTGOLDENRODYELLOW: Color = Color { - r: 0xFA, - g: 0xFA, - b: 0xD2, - a: 0xFF, - }; - pub const PAPAYAWHIP: Color = Color { - r: 0xFF, - g: 0xEF, - b: 0xD5, - a: 0xFF, - }; - pub const MOCCASIN: Color = Color { - r: 0xFF, - g: 0xE4, - b: 0xB5, - a: 0xFF, - }; - pub const PEACHPUFF: Color = Color { - r: 0xFF, - g: 0xDA, - b: 0xB9, - a: 0xFF, - }; - pub const PALEGOLDENROD: Color = Color { - r: 0xEE, - g: 0xE8, - b: 0xAA, - a: 0xFF, - }; - pub const KHAKI: Color = Color { - r: 0xF0, - g: 0xE6, - b: 0x8C, - a: 0xFF, - }; - pub const DARKKHAKI: Color = Color { - r: 0xBD, - g: 0xB7, - b: 0x6B, - a: 0xFF, - }; - pub const YELLOW: Color = Color { - r: 0xFF, - g: 0xFF, - b: 0x00, - a: 0xFF, - }; - - - /// Green CSS colors /////////////////////////////////////////////////////// - pub const LAWNGREEN: Color = Color { - r: 0x7C, - g: 0xFC, - b: 0x00, - a: 0xFF, - }; - pub const CHARTREUSE: Color = Color { - r: 0x7F, - g: 0xFF, - b: 0x00, - a: 0xFF, - }; - pub const LIMEGREEN: Color = Color { - r: 0x32, - g: 0xCD, - b: 0x32, - a: 0xFF, - }; - pub const LIME: Color = Color { - r: 0x00, - g: 0xFF, - b: 0x00, - a: 0xFF, - }; - pub const FORESTGREEN: Color = Color { - r: 0x22, - g: 0x8B, - b: 0x22, - a: 0xFF, - }; - pub const GREEN: Color = Color { - r: 0x00, - g: 0x80, - b: 0x00, - a: 0xFF, - }; - pub const DARKGREEN: Color = Color { - r: 0x00, - g: 0x64, - b: 0x00, - a: 0xFF, - }; - pub const GREENYELLOW: Color = Color { - r: 0xAD, - g: 0xFF, - b: 0x2F, - a: 0xFF, - }; - pub const YELLOWGREEN: Color = Color { - r: 0x9A, - g: 0xCD, - b: 0x32, - a: 0xFF, - }; - pub const SPRINGGREEN: Color = Color { - r: 0x00, - g: 0xFF, - b: 0x7F, - a: 0xFF, - }; - pub const MEDIUMSPINGGREEN: Color = Color { - r: 0x00, - g: 0xFA, - b: 0x9A, - a: 0xFF, - }; - pub const LIGHTGREEN: Color = Color { - r: 0x90, - g: 0xEE, - b: 0x90, - a: 0xFF, - }; - pub const PALEGREEN: Color = Color { - r: 0x98, - g: 0xFB, - b: 0x98, - a: 0xFF, - }; - pub const DARKSEAGREEN: Color = Color { - r: 0x8F, - g: 0xBC, - b: 0x8F, - a: 0xFF, - }; - pub const MEDIUMSEAGREEN: Color = Color { - r: 0x3C, - g: 0xB3, - b: 0x71, - a: 0xFF, - }; - pub const SEAGREEN: Color = Color { - r: 0x2E, - g: 0x8B, - b: 0x57, - a: 0xFF, - }; - pub const OLIVE: Color = Color { - r: 0x80, - g: 0x80, - b: 0x00, - a: 0xFF, - }; - pub const DARKOLIVE: Color = Color { - r: 0x55, - g: 0x6B, - b: 0x2F, - a: 0xFF, - }; - pub const OLIVEDRAB: Color = Color { - r: 0x6B, - g: 0x8E, - b: 0x23, - a: 0xFF, - }; - - /// Cyan CSS colors //////////////////////////////////////////////////////// - pub const LIGHTCYAN: Color = Color { - r: 0xE0, - g: 0xFF, - b: 0xFF, - a: 0xFF, - }; - pub const CYAN: Color = Color { - r: 0x00, - g: 0xFF, - b: 0xFF, - a: 0xFF, - }; - pub const AQUA: Color = Color { - r: 0xE0, - g: 0xFF, - b: 0xFF, - a: 0xFF, - }; - pub const AQUAMARINE: Color = Color { - r: 0x7F, - g: 0xFF, - b: 0xD4, - a: 0xFF, - }; - pub const MEDIUMAQUAMARINE: Color = Color { - r: 0x66, - g: 0xCD, - b: 0xAA, - a: 0xFF, - }; - pub const PALETURQUOISE: Color = Color { - r: 0xAF, - g: 0xEE, - b: 0xEE, - a: 0xFF, - }; - pub const TURQUOISE: Color = Color { - r: 0x40, - g: 0xE0, - b: 0xD0, - a: 0xFF, - }; - pub const MEDIUMTURQUOISE: Color = Color { - r: 0x48, - g: 0xD1, - b: 0xCC, - a: 0xFF, - }; - pub const DARKTURQUOISE: Color = Color { - r: 0x00, - g: 0xCE, - b: 0xD1, - a: 0xFF, - }; - pub const LIGHTSEAGREEN: Color = Color { - r: 0x20, - g: 0xB2, - b: 0xAA, - a: 0xFF, - }; - pub const CADETBLUE: Color = Color { - r: 0x5F, - g: 0x9E, - b: 0xA0, - a: 0xFF, - }; - pub const DARKCYAN: Color = Color { - r: 0x00, - g: 0x8B, - b: 0x8B, - a: 0xFF, - }; - pub const TEAL: Color = Color { - r: 0x00, - g: 0x80, - b: 0x80, - a: 0xFF, - }; - - /// Blue CSS colors //////////////////////////////////////////////////////// - pub const POWDERBLUE: Color = Color { - r: 0xB0, - g: 0xE0, - b: 0xE6, - a: 0xFF, - }; - pub const LIGHTBLUE: Color = Color { - r: 0xAD, - g: 0xD8, - b: 0xE6, - a: 0xFF, - }; - pub const LIGHTSKYBLUE: Color = Color { - r: 0x87, - g: 0xCE, - b: 0xFA, - a: 0xFF, - }; - pub const SKYBLUE: Color = Color { - r: 0x87, - g: 0xCE, - b: 0xEB, - a: 0xFF, - }; - pub const DEEPSKYBLUE: Color = Color { - r: 0x00, - g: 0xBF, - b: 0xFF, - a: 0xFF, - }; - pub const LIGHTSTEELBLUE: Color = Color { - r: 0xB0, - g: 0xC4, - b: 0xDE, - a: 0xFF, - }; - pub const DODGERBLUE: Color = Color { - r: 0x1E, - g: 0x90, - b: 0xFF, - a: 0xFF, - }; - pub const CORNFLOWERBLUE: Color = Color { - r: 0x64, - g: 0x95, - b: 0xED, - a: 0xFF, - }; - pub const STEELBLUE: Color = Color { - r: 0x46, - g: 0x82, - b: 0xB4, - a: 0xFF, - }; - pub const ROYALBLUE: Color = Color { - r: 0x41, - g: 0x69, - b: 0xE1, - a: 0xFF, - }; - pub const BLUE: Color = Color { - r: 0x00, - g: 0x00, - b: 0xFF, - a: 0xFF, - }; - pub const MEDIUMBLUE: Color = Color { - r: 0x00, - g: 0x00, - b: 0xCD, - a: 0xFF, - }; - pub const DARKBLUE: Color = Color { - r: 0x00, - g: 0x00, - b: 0x8B, - a: 0xFF, - }; - pub const NAVY: Color = Color { - r: 0x00, - g: 0x00, - b: 0x80, - a: 0xFF, - }; - pub const MIDNIGHTBLUE: Color = Color { - r: 0x19, - g: 0x19, - b: 0x70, - a: 0xFF, - }; - pub const MEDIUMSLATEBLUE: Color = Color { - r: 0x7B, - g: 0x68, - b: 0xEE, - a: 0xFF, - }; - pub const SLATEBLUE: Color = Color { - r: 0x6A, - g: 0x5A, - b: 0xCD, - a: 0xFF, - }; - pub const DARKSLATEBLUE: Color = Color { - r: 0x48, - g: 0x3D, - b: 0x8B, - a: 0xFF, - }; - - /// Purple CSS colors ////////////////////////////////////////////////////// - pub const LAVENDER: Color = Color { - r: 0xE6, - g: 0xE6, - b: 0xFA, - a: 0xFF, - }; - pub const THISTLE: Color = Color { - r: 0xD8, - g: 0xBF, - b: 0xD8, - a: 0xFF, - }; - pub const PLUM: Color = Color { - r: 0xDD, - g: 0xA0, - b: 0xDD, - a: 0xFF, - }; - pub const VIOLET: Color = Color { - r: 0xEE, - g: 0x82, - b: 0xEE, - a: 0xFF, - }; - pub const ORCHID: Color = Color { - r: 0xDA, - g: 0x70, - b: 0xD6, - a: 0xFF, - }; - pub const FUCHSIA: Color = Color { - r: 0xFF, - g: 0x00, - b: 0xFF, - a: 0xFF, - }; - pub const MAGENTA: Color = Color { - r: 0xFF, - g: 0x00, - b: 0xFF, - a: 0xFF, - }; - pub const MEDIUMORCHID: Color = Color { - r: 0xBA, - g: 0x55, - b: 0xD3, - a: 0xFF, - }; - pub const MEDIUMPURPLE: Color = Color { - r: 0x93, - g: 0x70, - b: 0xDB, - a: 0xFF, - }; - pub const BLUEVIOLET: Color = Color { - r: 0x8A, - g: 0x2B, - b: 0xE2, - a: 0xFF, - }; - pub const DARKVIOLET: Color = Color { - r: 0x94, - g: 0x00, - b: 0xD3, - a: 0xFF, - }; - pub const DARKORCHID: Color = Color { - r: 0x99, - g: 0x32, - b: 0xCC, - a: 0xFF, - }; - pub const DARKMAGENTA: Color = Color { - r: 0x8B, - g: 0x00, - b: 0x8B, - a: 0xFF, - }; - pub const PURPLE: Color = Color { - r: 0x80, - g: 0x00, - b: 0x80, - a: 0xFF, - }; - pub const INDIGO: Color = Color { - r: 0x4B, - g: 0x00, - b: 0x82, - a: 0xFF, - }; - - /// Pink CSS colors //////////////////////////////////////////////////////// - pub const PINK: Color = Color { - r: 0xFF, - g: 0xC0, - b: 0xCB, - a: 0xFF, - }; - pub const LIGHTPINK: Color = Color { - r: 0xFF, - g: 0xB6, - b: 0xC1, - a: 0xFF, - }; - pub const HOTPINK: Color = Color { - r: 0xFF, - g: 0x69, - b: 0xB4, - a: 0xFF, - }; - pub const DEEPPINK: Color = Color { - r: 0xFF, - g: 0x14, - b: 0x93, - a: 0xFF, - }; - pub const PALEVIOLETRED: Color = Color { - r: 0xDB, - g: 0x70, - b: 0x93, - a: 0xFF, - }; - pub const MEDIUMVIOLETRED: Color = Color { - r: 0xC7, - g: 0x15, - b: 0x85, - a: 0xFF, - }; - - /// White CSS colors /////////////////////////////////////////////////////// - pub const WHITE: Color = Color { - r: 0xFF, - g: 0xFF, - b: 0xFF, - a: 0xFF, - }; - pub const SNOW: Color = Color { - r: 0xFF, - g: 0xFA, - b: 0xFA, - a: 0xFF, - }; - pub const HONEYDEW: Color = Color { - r: 0xF0, - g: 0xFF, - b: 0xF0, - a: 0xFF, - }; - pub const MINTCREAM: Color = Color { - r: 0xF5, - g: 0xFF, - b: 0xFA, - a: 0xFF, - }; - pub const AZURE: Color = Color { - r: 0xF0, - g: 0xFF, - b: 0xFF, - a: 0xFF, - }; - pub const ALICEBLUE: Color = Color { - r: 0xF0, - g: 0xF8, - b: 0xFF, - a: 0xFF, - }; - pub const GHOSTWHITE: Color = Color { - r: 0xF8, - g: 0xF8, - b: 0xFF, - a: 0xFF, - }; - pub const WHITESMOKE: Color = Color { - r: 0xF5, - g: 0xF5, - b: 0xF5, - a: 0xFF, - }; - pub const SEASHELL: Color = Color { - r: 0xFF, - g: 0xF5, - b: 0xEE, - a: 0xFF, - }; - pub const BEIGE: Color = Color { - r: 0xF5, - g: 0xF5, - b: 0xDC, - a: 0xFF, - }; - pub const OLDLACE: Color = Color { - r: 0xFD, - g: 0xF5, - b: 0xE6, - a: 0xFF, - }; - pub const FLORALWHITE: Color = Color { - r: 0xFF, - g: 0xFA, - b: 0xF0, - a: 0xFF, - }; - pub const IVORY: Color = Color { - r: 0xFF, - g: 0xFF, - b: 0xF0, - a: 0xFF, - }; - pub const ANTIQUEWHITE: Color = Color { - r: 0xFA, - g: 0xEB, - b: 0xD7, - a: 0xFF, - }; - pub const LINEN: Color = Color { - r: 0xFA, - g: 0xF0, - b: 0xE6, - a: 0xFF, - }; - pub const LAVENDERBLUSH: Color = Color { - r: 0xFF, - g: 0xF0, - b: 0xF5, - a: 0xFF, - }; - pub const MISTYROSE: Color = Color { - r: 0xFF, - g: 0xE4, - b: 0xE1, - a: 0xFF, - }; - - /// Gray CSS colors //////////////////////////////////////////////////////// - pub const GAINSBORO: Color = Color { - r: 0xDC, - g: 0xDC, - b: 0xDC, - a: 0xFF, - }; - pub const LIGHTGRAY: Color = Color { - r: 0xD3, - g: 0xD3, - b: 0xD3, - a: 0xFF, - }; - pub const SILVER: Color = Color { - r: 0xC0, - g: 0xC0, - b: 0xC0, - a: 0xFF, - }; - pub const DARKGRAY: Color = Color { - r: 0xA9, - g: 0xA9, - b: 0xA9, - a: 0xFF, - }; - pub const GRAY: Color = Color { - r: 0x80, - g: 0x80, - b: 0x80, - a: 0xFF, - }; - pub const DIMGRAY: Color = Color { - r: 0x69, - g: 0x69, - b: 0x69, - a: 0xFF, - }; - pub const LIGHTSLATEGRAY: Color = Color { - r: 0x77, - g: 0x88, - b: 0x99, - a: 0xFF, - }; - pub const SLATEGRAY: Color = Color { - r: 0x70, - g: 0x80, - b: 0x90, - a: 0xFF, - }; - pub const DARKSLATEGRAY: Color = Color { - r: 0x2F, - g: 0x4F, - b: 0x4F, - a: 0xFF, - }; - pub const BLACK: Color = Color { - r: 0x00, - g: 0x00, - b: 0x00, - a: 0xFF, - }; - - /// Brown CSS colors /////////////////////////////////////////////////////// - pub const CORNSILK: Color = Color { - r: 0xFF, - g: 0xF8, - b: 0xDC, - a: 0xFF, - }; - pub const BLANCHEDALMOND: Color = Color { - r: 0xFF, - g: 0xEB, - b: 0xCD, - a: 0xFF, - }; - pub const BISQUE: Color = Color { - r: 0xFF, - g: 0xE4, - b: 0xC4, - a: 0xFF, - }; - pub const NAVAJOWHITE: Color = Color { - r: 0xFF, - g: 0xDE, - b: 0xAD, - a: 0xFF, - }; - pub const WHEAT: Color = Color { - r: 0xF5, - g: 0xDE, - b: 0xB3, - a: 0xFF, - }; - pub const BURLYWOOD: Color = Color { - r: 0xDE, - g: 0xB8, - b: 0x87, - a: 0xFF, - }; - pub const TAN: Color = Color { - r: 0xD2, - g: 0xB4, - b: 0x8C, - a: 0xFF, - }; - pub const ROSYBROWN: Color = Color { - r: 0xBC, - g: 0x8F, - b: 0x8F, - a: 0xFF, - }; - pub const SANDYBROWN: Color = Color { - r: 0xF4, - g: 0xA4, - b: 0x60, - a: 0xFF, - }; - pub const GOLDENROD: Color = Color { - r: 0xDA, - g: 0xA5, - b: 0x20, - a: 0xFF, - }; - pub const PERU: Color = Color { - r: 0xCD, - g: 0x85, - b: 0x3F, - a: 0xFF, - }; - pub const CHOCOLATE: Color = Color { - r: 0xD2, - g: 0x69, - b: 0x1E, - a: 0xFF, - }; - pub const SADDLEBROWN: Color = Color { - r: 0x8B, - g: 0x45, - b: 0x13, - a: 0xFF, - }; - pub const SIENNA: Color = Color { - r: 0xA0, - g: 0x52, - b: 0x2D, - a: 0xFF, - }; - pub const BROWN: Color = Color { - r: 0xA5, - g: 0x2A, - b: 0x2A, - a: 0xFF, - }; - pub const MAROON: Color = Color { - r: 0x80, - g: 0x00, - b: 0x00, - a: 0xFF, - }; } impl Style {