tscad is in early development

colors

Color related functions

Use these functions to apply colors to your 3D objects in the preview etc.

Be sure to check out the general modelling guide if you're new to tscad

Methods and properties

Import
import { 
  
} from '@tscad/modeling/colors'

function colorize(color, object)

Colorize an object. The color itself is defined as an array of 3 (RGB) or 4 (RGBA) numbers between 0 and 1 corresponding to the red, green, blue, and (optional) alpha channels.

Examples

import { colorize } from '@tscad/modeling--colors/colors';
import { cube } from '@tscad/modeling--colors/primitives';

const coloredCube = colorize([1, 0, 0], cube({ size: 10 })); // Red cube

Parameters

Prop

Type

Defined in packages/modeling/src/colors/index.ts