Crates.io | weirdboi_bevy_colour |
lib.rs | weirdboi_bevy_colour |
version | 0.1.0 |
created_at | 2025-08-08 04:54:38.566987+00 |
updated_at | 2025-08-08 04:54:38.566987+00 |
description | Colour palettes for Bevy, with macros for compile-time palette definitions. |
homepage | https://weirdboi.dev/libraries/bevy-colours |
repository | https://weirdboi.dev/libraries/bevy-colours |
max_upload_size | |
id | 1786206 |
size | 56,039 |
A Rust library providing a collection of popular colour palettes for the Bevy game engine, with utilities for interacting with them.
Create colour palettes: Create flexible colour palettes with the palette!
macro
Pre-defined Colour Palettes: Includes several popular colour palettes from Lospec:
Visual Documentation: Each palette includes custom HTML when generating a Rustdoc to showcase the available colours. Integrates nicely with IDE doc previews
Add this to your Cargo.toml
:
[dependencies]
weirdboi_bevy_colour = "0.1.0"
use bevy::prelude::*;
use weirdboi_bevy_colour::Dawnbringer16;
fn setup(mut commands: Commands) {
let mut x = 0.0;
// Spawn a coloured square for each colour in the palette
for color in &Dawnbringer16 {
commands.spawn((
Sprite {
color,
custom_size: Some(Vec2::new(40.0, 40.0)),
..default()
},
Transform::from_xyz(x, 0.0, 0.0)
));
x += 50.0;
}
}
You can create your own colour palettes using the palette!
macro:
use weirdboi_bevy_colour::palette;
palette!(MyGamePalette {
"hero": (0.2, 0.6, 0.9),
"enemy": (0.9, 0.2, 0.3),
"background": (0.1, 0.1, 0.2),
"highlight": (1.0, 0.8, 0.0),
});
// Now you can use your palette just like the built-in ones:
let hero_colour = MyGamePalette::HERO;
let enemy_colour = MyGamePalette::enemy();
let bg_colour = MyGamePalette::get("BaCKgrouND").unwrap();
// Iterate over all colours
for colour in &MyGamePalette {
// Use colour...
}
version | bevy |
---|---|
0.1 | 0.16 |