MCPcopy Create free account
hub / github.com/arctic-cli/interface / createColors

Function createColors

packages/arctic/src/cli/cmd/tui/ui/spinner.ts:336–368  ·  view source on GitHub ↗
(options: KnightRiderOptions = {})

Source from the content-addressed store, hash-verified

334 * @returns ColorGenerator function
335 */
336export function createColors(options: KnightRiderOptions = {}): ColorGenerator {
337 const holdStart = options.holdStart ?? 30
338 const holdEnd = options.holdEnd ?? 9
339
340 const colors =
341 options.colors ??
342 (options.color
343 ? deriveTrailColors(options.color, options.trailSteps)
344 : [
345 RGBA.fromHex("#ff0000"), // Brightest Red (Center)
346 RGBA.fromHex("#ff5555"), // Glare/Bloom
347 RGBA.fromHex("#dd0000"), // Trail 1
348 RGBA.fromHex("#aa0000"), // Trail 2
349 RGBA.fromHex("#770000"), // Trail 3
350 RGBA.fromHex("#440000"), // Trail 4
351 ])
352
353 const defaultColor =
354 options.defaultColor ??
355 (options.color ? deriveInactiveColor(options.color, options.inactiveFactor) : RGBA.fromHex("#330000"))
356
357 const trailOptions = {
358 colors,
359 trailLength: colors.length,
360 defaultColor,
361 direction: "bidirectional" as const,
362 holdFrames: { start: holdStart, end: holdEnd },
363 enableFading: options.enableFading,
364 minAlpha: options.minAlpha,
365 }
366
367 return createKnightRiderTrail(trailOptions)
368}

Callers

nothing calls this directly

Calls 3

deriveTrailColorsFunction · 0.85
deriveInactiveColorFunction · 0.85
createKnightRiderTrailFunction · 0.85

Tested by

no test coverage detected