mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 18:57:03 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
92e35bd0ac |
No files matched your search
@@ -1,4 +1,6 @@
|
||||
# blitzkrieg
|
||||
# Blitzkrieg
|
||||
|
||||
[](https://codeium.com)
|
||||
|
||||
Tools for everything World of Tanks Blitz
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# Blitzkrieg 1.13.2
|
||||
|
||||
One lonely albeit important fix.
|
||||
|
||||
## Fixes
|
||||
|
||||
- Gradients for `/stats` now use Radix's new hex values
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "blitzkrieg",
|
||||
"version": "1.13.1",
|
||||
"version": "1.13.2",
|
||||
"description": "🎉 Tools for everything World of Tanks Blitz",
|
||||
"main": "src/server.ts",
|
||||
"type": "module",
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { Percentile } from '../../../../../constants/percentiles';
|
||||
import hslToHex from '../../../../../core/node/hslToHex';
|
||||
import { PERCENTILE_COLORS } from '../../../../PercentileIndicator';
|
||||
|
||||
export enum GlowSide {
|
||||
@@ -14,8 +13,8 @@ export interface GlowProps {
|
||||
|
||||
export function Glow({ percentile, side }: GlowProps) {
|
||||
const color = PERCENTILE_COLORS[percentile];
|
||||
const color1 = hslToHex(color);
|
||||
const color2 = `${color1}00`;
|
||||
const color1 = color;
|
||||
const color2 = `${color}00`;
|
||||
|
||||
const background = `linear-gradient(${
|
||||
side === GlowSide.Top ? 0 : 180
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
const numberRegex = /\d+(\.\d+)?/g;
|
||||
|
||||
/**
|
||||
* Thanks to icl7126!
|
||||
* https://stackoverflow.com/a/44134328/12294756
|
||||
*/
|
||||
export default function hslToHex(hsl: string) {
|
||||
let [h, s, l] = Array.from(hsl.matchAll(numberRegex)).map((m) =>
|
||||
parseFloat(m[0]),
|
||||
);
|
||||
|
||||
l /= 100;
|
||||
const a = (s * Math.min(l, 1 - l)) / 100;
|
||||
const f = (n: number) => {
|
||||
const k = (n + h / 30) % 12;
|
||||
const color = l - a * Math.max(Math.min(k - 3, 9 - k, 1), -1);
|
||||
return Math.round(255 * color)
|
||||
.toString(16)
|
||||
.padStart(2, '0'); // convert to Hex and prefix "0" if needed
|
||||
};
|
||||
return `#${f(0)}${f(8)}${f(4)}`;
|
||||
}
|
||||
Reference in new issue
Block a user