hex triplets for colors

This commit is contained in:
2026-07-26 11:18:30 -05:00
parent ba8c72d5a5
commit 9844671c46
5 changed files with 173 additions and 67 deletions
+3 -12
View File
@@ -197,13 +197,6 @@ mod tests {
spec.into_board(&HashSet::new()).expect("board spec converts")
}
/// An `{ r, g, b, a }` color table. `Glyph` derives serde straight onto
/// `color::Rgba8`, so map TOML spells colors out structurally rather than as
/// `"#rrggbb"` strings.
fn rgb(r: u8, g: u8, b: u8) -> String {
format!("{{ r = {r}, g = {g}, b = {b}, a = 255 }}")
}
/// Builds a tiny dark board: a 5×1 corridor with the player at the left end
/// and a wall at x=2 occluding the two cells behind it.
fn dark_corridor() -> Board {
@@ -267,7 +260,7 @@ mod tests {
// and a lamp you can walk through belongs off-grid. The player sits at x=0
// (Board::lighting reads player_pos for the sightline) but carries no torch,
// so the sensor is the only light.
let board = board_from(&format!(
let board = board_from(
r##"
name = "lit"
width = 6
@@ -284,11 +277,9 @@ mod tests {
draw_layer = "Above"
opaque = false
glow = 2
glyph = {{ tile = 1, fg = {fg}, bg = {bg} }}
glyph = { tile = 1, fg = "#FF0000", bg = "#000000" }
"##,
fg = rgb(255, 0, 0),
bg = rgb(0, 0, 0),
));
);
let fov = board.lighting(0); // no player torch — only the sensor lights
let area = Rect::new(0, 0, 6, 1);