Skip to content

Commit 92a6346

Browse files
committed
chore lint
1 parent 57dc4aa commit 92a6346

4 files changed

Lines changed: 35 additions & 26 deletions

File tree

src/color/categorical.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,19 +214,19 @@ const SPECTRUM_12 = [
214214
];
215215

216216
export const CATEGORICAL_PALETTES = {
217-
tycho11: TYCHO_11,
217+
'tycho11': TYCHO_11,
218218
'tycho-dark11': TYCHO_DARK_11,
219219
'tycho-robust11': TYCHO_ROBUST_11,
220220
'tycho-soft11': TYCHO_SOFT_11,
221221
'tycho-soft-dark11': TYCHO_SOFT_DARK_11,
222222
'tycho-bold11': TYCHO_BOLD_11,
223223
'tycho-bold-dark11': TYCHO_BOLD_DARK_11,
224-
tableau10: TABLEAU_10,
225-
kelly22: KELLY_22,
226-
mathematica10: MATHEMATICA_10,
227-
cupertino10: CUPERTINO_10,
224+
'tableau10': TABLEAU_10,
225+
'kelly22': KELLY_22,
226+
'mathematica10': MATHEMATICA_10,
227+
'cupertino10': CUPERTINO_10,
228228
'cupertino-dark10': CUPERTINO_DARK_10,
229-
spectrum12: SPECTRUM_12,
229+
'spectrum12': SPECTRUM_12,
230230
} as const;
231231

232232
export type CategoricalPaletteName = keyof typeof CATEGORICAL_PALETTES;

src/color/manipulation.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -673,9 +673,9 @@ export function parseColor(s: string): number {
673673
const lin = linSRGBFromLMS(lms);
674674

675675
// Gamma correct and clamp
676-
let r = Math.max(0, Math.min(1, gammaCorrect(lin.r)));
677-
let g = Math.max(0, Math.min(1, gammaCorrect(lin.g)));
678-
let b = Math.max(0, Math.min(1, gammaCorrect(lin.b)));
676+
const r = Math.max(0, Math.min(1, gammaCorrect(lin.r)));
677+
const g = Math.max(0, Math.min(1, gammaCorrect(lin.g)));
678+
const b = Math.max(0, Math.min(1, gammaCorrect(lin.b)));
679679

680680
const rByte = Math.round(r * 255);
681681
const gByte = Math.round(g * 255);

src/compute-engine/compilation/gpu-target.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,11 @@ export const GPU_FUNCTIONS: CompiledFunctions<Expression> = {
240240

241241
// Complex-specific functions
242242
Re: (args, compile) => {
243-
if (BaseCompiler.isComplexValued(args[0]))
244-
return `(${compile(args[0])}).x`;
243+
if (BaseCompiler.isComplexValued(args[0])) return `(${compile(args[0])}).x`;
245244
return compile(args[0]);
246245
},
247246
Im: (args, compile) => {
248-
if (BaseCompiler.isComplexValued(args[0]))
249-
return `(${compile(args[0])}).y`;
247+
if (BaseCompiler.isComplexValued(args[0])) return `(${compile(args[0])}).y`;
250248
return '0.0';
251249
},
252250
Arg: (args, compile) => {
@@ -1174,12 +1172,17 @@ export abstract class GPUShaderTarget implements LanguageTarget<Expression> {
11741172
preamble += buildComplexPreamble(code, this.languageId);
11751173
if (code.includes('_gpu_gamma')) preamble += GPU_GAMMA_PREAMBLE;
11761174
if (code.includes('_gpu_erf')) preamble += GPU_ERF_PREAMBLE;
1177-
if (code.includes('_gpu_srgb_to') || code.includes('_gpu_oklab') ||
1178-
code.includes('_gpu_oklch') || code.includes('_gpu_color_mix') ||
1179-
code.includes('_gpu_apca')) {
1180-
preamble += this.languageId === 'wgsl'
1181-
? GPU_COLOR_PREAMBLE_WGSL
1182-
: GPU_COLOR_PREAMBLE_GLSL;
1175+
if (
1176+
code.includes('_gpu_srgb_to') ||
1177+
code.includes('_gpu_oklab') ||
1178+
code.includes('_gpu_oklch') ||
1179+
code.includes('_gpu_color_mix') ||
1180+
code.includes('_gpu_apca')
1181+
) {
1182+
preamble +=
1183+
this.languageId === 'wgsl'
1184+
? GPU_COLOR_PREAMBLE_WGSL
1185+
: GPU_COLOR_PREAMBLE_GLSL;
11831186
}
11841187
if (preamble) result.preamble = preamble;
11851188
return result;

src/compute-engine/compilation/javascript-target.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -836,10 +836,7 @@ const colorHelpers = {
836836
return this._interpolatePalette(colors, t);
837837
},
838838

839-
_interpolatePalette(
840-
colors: [number, number, number][],
841-
t: number
842-
): number[] {
839+
_interpolatePalette(colors: [number, number, number][], t: number): number[] {
843840
if (colors.length === 0) return [0, 0, 0];
844841
if (t <= 0) return [...colors[0]];
845842
if (t >= 1) return [...colors[colors.length - 1]];
@@ -848,11 +845,20 @@ const colorHelpers = {
848845
const i = Math.floor(pos);
849846
const frac = pos - i;
850847

851-
if (frac === 0 || i >= colors.length - 1) return [...colors[Math.min(i, colors.length - 1)]];
848+
if (frac === 0 || i >= colors.length - 1)
849+
return [...colors[Math.min(i, colors.length - 1)]];
852850

853851
// Interpolate in OKLCh for perceptual uniformity
854-
const rgb1 = { r: colors[i][0] * 255, g: colors[i][1] * 255, b: colors[i][2] * 255 };
855-
const rgb2 = { r: colors[i + 1][0] * 255, g: colors[i + 1][1] * 255, b: colors[i + 1][2] * 255 };
852+
const rgb1 = {
853+
r: colors[i][0] * 255,
854+
g: colors[i][1] * 255,
855+
b: colors[i][2] * 255,
856+
};
857+
const rgb2 = {
858+
r: colors[i + 1][0] * 255,
859+
g: colors[i + 1][1] * 255,
860+
b: colors[i + 1][2] * 255,
861+
};
856862
const c1 = rgbToOklch(rgb1);
857863
const c2 = rgbToOklch(rgb2);
858864

0 commit comments

Comments
 (0)