> ## Documentation Index
> Fetch the complete documentation index at: https://docs.0xarchive.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Colours, text and time

> color, fmt, clock, log and random.

Colours, formatting, time, logging, randomness

## color

<ResponseField name="up" type="Color">
  The theme's up and down colours, and a neutral text colour.
</ResponseField>

<ResponseField name="down" type="Color" />

<ResponseField name="neutral" type="Color" />

<ResponseField name="panel" type="Color">
  The chart's own background, for a table or label that should sit on the theme's surface.
</ResponseField>

<ResponseField name="none" type="Color">
  A colour that draws nothing: a transparent line segment, bar or shade.
</ResponseField>

<ResponseField name="study()" type="(i: number): Color">
  The theme's study palette, `i` from 0 to 15.
</ResponseField>

<ResponseField name="rgb()" type="(r: number, g: number, b: number, alpha?: number): Color">
  A colour from red, green and blue, 0 to 255, and `alpha` from 0 to 1.
</ResponseField>

<ResponseField name="withAlpha()" type="(c: Color, alpha: number): Color">
  The same colour with `alpha` from 0 (transparent) to 1: `#rrggbbaa` for a hex colour, `theme:up@0.3` for a token.
</ResponseField>

<ResponseField name="mix()" type="(a: Color, b: Color, t: number): Color">
  A colour between two hex colours, `t` from 0 to 1. A theme token cannot be mixed: `a` comes back.
</ResponseField>

## fmt

<ResponseField name="price()" type="(value: number): string">
  A price in the market's own precision.
</ResponseField>

<ResponseField name="num()" type="(value: number, decimals?: number): string">
  A number with a comma every three digits and `decimals` places, as the terminal writes numbers whatever the reader's locale.
</ResponseField>

<ResponseField name="usd()" type="(value: number): string">
  `$1.2M`, `$350k`.
</ResponseField>

<ResponseField name="pct()" type="(value: number, decimals?: number): string">
  A fraction as a percent: `pct(0.0123)` is `1.23%`.
</ResponseField>

<ResponseField name="compact()" type="(value: number): string">
  A number shortened with a suffix, `1.2M` or `350k`, as the axes of a script's own pane print.
</ResponseField>

## clock

<ResponseField name="parts()" type="(time: Time, timeZone?: string): TimeParts">
  Calendar fields of `time` in `timeZone` (IANA name), UTC by default.
</ResponseField>

<ResponseField name="startOf()" type="(time: Time, unit: 'day' | 'week' | 'month' | 'quarter' | 'year', timeZone?: string): Time">
  The start of the day, week (Monday), month, quarter or year that contains `time`.
</ResponseField>

## TimeParts

<ResponseField name="year" type="number" />

<ResponseField name="month" type="number" />

<ResponseField name="day" type="number" />

<ResponseField name="hour" type="number" />

<ResponseField name="minute" type="number" />

<ResponseField name="second" type="number" />

<ResponseField name="dayOfWeek" type="number">
  0 Sunday to 6 Saturday.
</ResponseField>

## log

Lines in the script's console, each with the time of the bar it was written on; 1,000 at most, oldest dropped.

<ResponseField name="info()" type="(...values: unknown[]): void" />

<ResponseField name="warn()" type="(...values: unknown[]): void" />

<ResponseField name="error()" type="(...values: unknown[]): void" />

## random()

A seeded random number generator: the same seed gives the same numbers everywhere.

```ts theme={"theme":"github-dark"}
function random(seed: number): { next(): number };
```

## Next step

See what each code means in [diagnostics](/terminal/reference/diagnostics).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.