mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 06:41:48 +00:00
vscode: yet another refactor commit
This commit is contained in:
parent
c9e1aab880
commit
b89b22e43e
7 changed files with 30 additions and 35 deletions
|
@ -69,7 +69,7 @@ interface Decoration {
|
|||
|
||||
// Based on this HSL-based color generator: https://gist.github.com/bendc/76c48ce53299e6078a76
|
||||
function fancify(seed: string, shade: 'light' | 'dark') {
|
||||
const random = randomU32Numbers(hashString(seed))
|
||||
const random = randomU32Numbers(hashString(seed));
|
||||
const randomInt = (min: number, max: number) => {
|
||||
return Math.abs(random()) % (max - min + 1) + min;
|
||||
};
|
||||
|
@ -253,14 +253,14 @@ function randomU32Numbers(seed: number) {
|
|||
random ^= random >> 17;
|
||||
random ^= random << 5;
|
||||
random |= 0;
|
||||
return random
|
||||
}
|
||||
return random;
|
||||
};
|
||||
}
|
||||
|
||||
function hashString(str: string): number {
|
||||
let res = 0;
|
||||
for (let i = 0; i < str.length; ++i) {
|
||||
const c = str.codePointAt(i)!!;
|
||||
const c = str.codePointAt(i)!;
|
||||
res = (res * 31 + c) & ~0;
|
||||
}
|
||||
return res;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue