aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/syntax_highlighting/html.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/syntax_highlighting/html.rs')
-rw-r--r--crates/ra_ide/src/syntax_highlighting/html.rs15
1 files changed, 8 insertions, 7 deletions
diff --git a/crates/ra_ide/src/syntax_highlighting/html.rs b/crates/ra_ide/src/syntax_highlighting/html.rs
index 0c74f7370..a5e7d2867 100644
--- a/crates/ra_ide/src/syntax_highlighting/html.rs
+++ b/crates/ra_ide/src/syntax_highlighting/html.rs
@@ -1,5 +1,6 @@
1//! Renders a bit of code as HTML. 1//! Renders a bit of code as HTML.
2 2
3use oorandom::Rand32;
3use ra_db::SourceDatabase; 4use ra_db::SourceDatabase;
4use ra_syntax::{AstNode, TextRange, TextSize}; 5use ra_syntax::{AstNode, TextRange, TextSize};
5 6
@@ -9,13 +10,12 @@ pub(crate) fn highlight_as_html(db: &RootDatabase, file_id: FileId, rainbow: boo
9 let parse = db.parse(file_id); 10 let parse = db.parse(file_id);
10 11
11 fn rainbowify(seed: u64) -> String { 12 fn rainbowify(seed: u64) -> String {
12 use rand::prelude::*; 13 let mut rng = Rand32::new(seed);
13 let mut rng = SmallRng::seed_from_u64(seed);
14 format!( 14 format!(
15 "hsl({h},{s}%,{l}%)", 15 "hsl({h},{s}%,{l}%)",
16 h = rng.gen_range::<u16, _, _>(0, 361), 16 h = rng.rand_range(0..361),
17 s = rng.gen_range::<u16, _, _>(42, 99), 17 s = rng.rand_range(42..99),
18 l = rng.gen_range::<u16, _, _>(40, 91), 18 l = rng.rand_range(40..91),
19 ) 19 )
20 } 20 }
21 21
@@ -83,14 +83,15 @@ pre { color: #DCDCCC; background: #3F3F3F; font-size: 22px; padd
83.bool_literal { color: #BFE6EB; } 83.bool_literal { color: #BFE6EB; }
84.macro { color: #94BFF3; } 84.macro { color: #94BFF3; }
85.module { color: #AFD8AF; } 85.module { color: #AFD8AF; }
86.value_param { color: #DCDCCC; }
86.variable { color: #DCDCCC; } 87.variable { color: #DCDCCC; }
87.format_specifier { color: #CC696B; } 88.format_specifier { color: #CC696B; }
88.mutable { text-decoration: underline; } 89.mutable { text-decoration: underline; }
89.unresolved_reference { color: #FC5555; }
90.escape_sequence { color: #94BFF3; } 90.escape_sequence { color: #94BFF3; }
91
92.keyword { color: #F0DFAF; font-weight: bold; } 91.keyword { color: #F0DFAF; font-weight: bold; }
93.keyword.unsafe { color: #BC8383; font-weight: bold; } 92.keyword.unsafe { color: #BC8383; font-weight: bold; }
94.control { font-style: italic; } 93.control { font-style: italic; }
94
95.unresolved_reference { color: #FC5555; text-decoration: wavy underline; }
95</style> 96</style>
96"; 97";