Visual Foundations
Before jumping into your first scene, itβs important to understand how Murali thinks about space, positioning, and visuals.
Murali uses a deterministic, world-coordinate system β not pixels β which makes animations predictable and reproducible.
This page builds the mental model you need.
Key Ideaβ
Murali is not pixel-based.
Everything is defined in a world coordinate system, which makes:
- layouts predictable
- animations resolution-independent
- outputs reproducible
Colorsβ
Murali defines constants for colors so that it is easy to use them while creating scenes.
| Category | Color | Preview |
|---|---|---|
| Achromatic | WHITE | #FFFFFF |
| BLACK | #000000 | |
| GRAY_A β GRAY_E | ||
| Blue | BLUE_A β BLUE_E | |
| Teal | TEAL_A β TEAL_E | |
| Green | GREEN_A β GREEN_E | |
| Yellow | YELLOW_A β YELLOW_E | |
| Gold | GOLD_A β GOLD_E | |
| Orange | ORANGE_A β ORANGE_E | |
| Red | RED_A β RED_E | |
| Maroon | MAROON_A β MAROON_E | |
| Purple | PURPLE_A β PURPLE_E | |
| Pink | PINK_A β PINK_E | |
| Pure | PURE_RED / PURE_GREEN / PURE_BLUE |
How to think about colorsβ
- Use palette constants (e.g.
BLUE_C,GREEN_E) for semantic meaning - Use raw colors (
Vec4) for fine-tuned visuals (backgrounds, subtle tones) - Prefer consistency over variety
use murali::colors::*;
let circle_id = scene.add_tattva(
Circle::new(1.5, 48, GREEN_E),
ORIGIN,
);
Positionsβ
In Murali, the center of the screen is (0, 0, 0).
You define positions using:
Vec3::new(x, y, z)
+xβ right-xβ left+yβ up-yβ downzβ depth (used for layering; higher values come closer to the camera)
In Murali, positions are absolute and deterministic β the same coordinates always produce the same visual result.
You can either use raw vectors:
Vec3::new(2.0, 1.0, 0.0)
Or use predefined constants from murali::positions.
use glam::Vec3;
pub const ORIGIN: Vec3 = Vec3::ZERO;
pub const CAMERA_DEFAULT_POS: Vec3 = Vec3::new(0.0, 0.0, 10.0);
pub const UP: Vec3 = Vec3::Y;
pub const DOWN: Vec3 = Vec3::NEG_Y;
pub const LEFT: Vec3 = Vec3::NEG_X;
pub const RIGHT: Vec3 = Vec3::X;
Common Position Constantsβ
| Name | Vector | Meaning | Visual |
|---|---|---|---|
UP | (0, 1, 0) | Move upward | β¬οΈ |
DOWN | (0, -1, 0) | Move downward | β¬οΈ |
LEFT | (-1, 0, 0) | Move left | β¬ οΈ |
RIGHT | (1, 0, 0) | Move right | β‘οΈ |
ORIGIN | (0, 0, 0) | Center of screen | π― |
CAMERA_DEFAULT_POS | (0, 0, 10) | Default camera position | π· |
Themesβ
Murali provides two built-in themes:
dark(default)light
Themes define:
- background color
- surface colors
- text colors
- accent colors
Once you're comfortable, you should create your own theme to define a consistent visual identity.
Creating a custom themeβ
- Create a
themes/folder next to yourCargo.toml - Add a file (e.g.
sesh.toml) - Define the required fields
Example:
name = "murali-dark"
background = "#0A121C"
surface = "#1C2E45"
surface_alt = "#2B405C"
text_primary = "#F2F7FC"
text_muted = "#BCCEE2"
accent = "#56C1F4"
accent_alt = "#AA8EF9"
positive = "#4FD193"
warning = "#F9B742"
Palettesβ
For advanced use cases, Murali supports custom palettes.
Palettes allow you to define your own color systems beyond the built-in constants.
How to create a paletteβ
- Create a
palette/folder next to yourCargo.toml - Add a file (e.g.
my_palette.toml) - Define your colors inside
This feature is evolving β examples will be added soon.
You now have the core mental model for how Murali represents visuals.
β Continue to First Scene