The PICO-8 is a virtual video game console created by Lexaloffle Games.
🦀 Rust
#![no_std]
#![no_main]
use firefly_rust::*;
#[unsafe(no_mangle)]
extern "C" fn boot() {
set_colors();
}
fn set_colors() {
// https://lospec.com/palette-list/pico-8
set_color(Color::from(1), RGB::new(0x00, 0x00, 0x00));
set_color(Color::from(2), RGB::new(0x1D, 0x2B, 0x53));
set_color(Color::from(3), RGB::new(0x7E, 0x25, 0x53));
set_color(Color::from(4), RGB::new(0x00, 0x87, 0x51));
set_color(Color::from(5), RGB::new(0xAB, 0x52, 0x36));
set_color(Color::from(6), RGB::new(0x5F, 0x57, 0x4F));
set_color(Color::from(7), RGB::new(0xC2, 0xC3, 0xC7));
set_color(Color::from(8), RGB::new(0xFF, 0xF1, 0xE8));
set_color(Color::from(9), RGB::new(0xFF, 0x00, 0x4D));
set_color(Color::from(10), RGB::new(0xFF, 0xA3, 0x00));
set_color(Color::from(11), RGB::new(0xFF, 0xEC, 0x27));
set_color(Color::from(12), RGB::new(0x00, 0xE4, 0x36));
set_color(Color::from(13), RGB::new(0x29, 0xAD, 0xFF));
set_color(Color::from(14), RGB::new(0x83, 0x76, 0x9C));
set_color(Color::from(15), RGB::new(0xFF, 0x77, 0xA8));
set_color(Color::from(16), RGB::new(0xFF, 0xCC, 0xAA));
}
🏃 Go
package main
import "github.com/firefly-zero/firefly-go/firefly"
func init() {
firefly.Boot = boot
}
func boot() {
setColors()
}
func setColors() {
// https://lospec.com/palette-list/pico-8
firefly.SetColor(1, firefly.RGB{R: 0x00, G: 0x00, B: 0x00})
firefly.SetColor(2, firefly.RGB{R: 0x1D, G: 0x2B, B: 0x53})
firefly.SetColor(3, firefly.RGB{R: 0x7E, G: 0x25, B: 0x53})
firefly.SetColor(4, firefly.RGB{R: 0x00, G: 0x87, B: 0x51})
firefly.SetColor(5, firefly.RGB{R: 0xAB, G: 0x52, B: 0x36})
firefly.SetColor(6, firefly.RGB{R: 0x5F, G: 0x57, B: 0x4F})
firefly.SetColor(7, firefly.RGB{R: 0xC2, G: 0xC3, B: 0xC7})
firefly.SetColor(8, firefly.RGB{R: 0xFF, G: 0xF1, B: 0xE8})
firefly.SetColor(9, firefly.RGB{R: 0xFF, G: 0x00, B: 0x4D})
firefly.SetColor(10, firefly.RGB{R: 0xFF, G: 0xA3, B: 0x00})
firefly.SetColor(11, firefly.RGB{R: 0xFF, G: 0xEC, B: 0x27})
firefly.SetColor(12, firefly.RGB{R: 0x00, G: 0xE4, B: 0x36})
firefly.SetColor(13, firefly.RGB{R: 0x29, G: 0xAD, B: 0xFF})
firefly.SetColor(14, firefly.RGB{R: 0x83, G: 0x76, B: 0x9C})
firefly.SetColor(15, firefly.RGB{R: 0xFF, G: 0x77, B: 0xA8})
firefly.SetColor(16, firefly.RGB{R: 0xFF, G: 0xCC, B: 0xAA})
}
⚡️ Zig
const ff = @import("firefly");
pub export fn update() void {
setColors()
}
fn setColors() void {
// https://lospec.com/palette-list/pico-8
ff.setColor(@enumFromInt(1), ff.RGB{.r = 0x00, .g = 0x00, .b = 0x00});
ff.setColor(@enumFromInt(2), ff.RGB{.r = 0x1D, .g = 0x2B, .b = 0x53});
ff.setColor(@enumFromInt(3), ff.RGB{.r = 0x7E, .g = 0x25, .b = 0x53});
ff.setColor(@enumFromInt(4), ff.RGB{.r = 0x00, .g = 0x87, .b = 0x51});
ff.setColor(@enumFromInt(5), ff.RGB{.r = 0xAB, .g = 0x52, .b = 0x36});
ff.setColor(@enumFromInt(6), ff.RGB{.r = 0x5F, .g = 0x57, .b = 0x4F});
ff.setColor(@enumFromInt(7), ff.RGB{.r = 0xC2, .g = 0xC3, .b = 0xC7});
ff.setColor(@enumFromInt(8), ff.RGB{.r = 0xFF, .g = 0xF1, .b = 0xE8});
ff.setColor(@enumFromInt(9), ff.RGB{.r = 0xFF, .g = 0x00, .b = 0x4D});
ff.setColor(@enumFromInt(10), ff.RGB{.r = 0xFF, .g = 0xA3, .b = 0x00});
ff.setColor(@enumFromInt(11), ff.RGB{.r = 0xFF, .g = 0xEC, .b = 0x27});
ff.setColor(@enumFromInt(12), ff.RGB{.r = 0x00, .g = 0xE4, .b = 0x36});
ff.setColor(@enumFromInt(13), ff.RGB{.r = 0x29, .g = 0xAD, .b = 0xFF});
ff.setColor(@enumFromInt(14), ff.RGB{.r = 0x83, .g = 0x76, .b = 0x9C});
ff.setColor(@enumFromInt(15), ff.RGB{.r = 0xFF, .g = 0x77, .b = 0xA8});
ff.setColor(@enumFromInt(16), ff.RGB{.r = 0xFF, .g = 0xCC, .b = 0xAA});
}
🐀 C
#include "./vendor/firefly/firefly.c"
BOOT void boot()
{
set_colors();
}
void set_colors()
{
// https://lospec.com/palette-list/pico-8
RGB color1 = {0x00, 0x00, 0x00};
set_color(1, color1);
RGB color2 = {0x1D, 0x2B, 0x53};
set_color(2, color2);
RGB color3 = {0x7E, 0x25, 0x53};
set_color(3, color3);
RGB color4 = {0x00, 0x87, 0x51};
set_color(4, color4);
RGB color5 = {0xAB, 0x52, 0x36};
set_color(5, color5);
RGB color6 = {0x5F, 0x57, 0x4F};
set_color(6, color6);
RGB color7 = {0xC2, 0xC3, 0xC7};
set_color(7, color7);
RGB color8 = {0xFF, 0xF1, 0xE8};
set_color(8, color8);
RGB color9 = {0xFF, 0x00, 0x4D};
set_color(9, color9);
RGB color10 = {0xFF, 0xA3, 0x00};
set_color(10, color10);
RGB color11 = {0xFF, 0xEC, 0x27};
set_color(11, color11);
RGB color12 = {0x00, 0xE4, 0x36};
set_color(12, color12);
RGB color13 = {0x29, 0xAD, 0xFF};
set_color(13, color13);
RGB color14 = {0x83, 0x76, 0x9C};
set_color(14, color14);
RGB color15 = {0xFF, 0x77, 0xA8};
set_color(15, color15);
RGB color16 = {0xFF, 0xCC, 0xAA};
set_color(16, color16);
}
➕ C++
#include "./vendor/firefly/firefly.c"
BOOT void boot()
{
set_colors();
}
void set_colors()
{
// https://lospec.com/palette-list/pico-8
set_color(1, {0x00, 0x00, 0x00});
set_color(2, {0x1D, 0x2B, 0x53});
set_color(3, {0x7E, 0x25, 0x53});
set_color(4, {0x00, 0x87, 0x51});
set_color(5, {0xAB, 0x52, 0x36});
set_color(6, {0x5F, 0x57, 0x4F});
set_color(7, {0xC2, 0xC3, 0xC7});
set_color(8, {0xFF, 0xF1, 0xE8});
set_color(9, {0xFF, 0x00, 0x4D});
set_color(10, {0xFF, 0xA3, 0x00});
set_color(11, {0xFF, 0xEC, 0x27});
set_color(12, {0x00, 0xE4, 0x36});
set_color(13, {0x29, 0xAD, 0xFF});
set_color(14, {0x83, 0x76, 0x9C});
set_color(15, {0xFF, 0x77, 0xA8});
set_color(16, {0xFF, 0xCC, 0xAA});
}
🐰 MoonBit
///|
using @firefly {type Color, type RGB}
///|
pub fn boot() -> Unit {
set_colors()
}
///|
fn set_colors() -> Unit {
// https://lospec.com/palette-list/pico-8
@firefly.set_color(Color::from_int(1), RGB::new(0x00, 0x00, 0x00));
@firefly.set_color(Color::from_int(2), RGB::new(0x1D, 0x2B, 0x53));
@firefly.set_color(Color::from_int(3), RGB::new(0x7E, 0x25, 0x53));
@firefly.set_color(Color::from_int(4), RGB::new(0x00, 0x87, 0x51));
@firefly.set_color(Color::from_int(5), RGB::new(0xAB, 0x52, 0x36));
@firefly.set_color(Color::from_int(6), RGB::new(0x5F, 0x57, 0x4F));
@firefly.set_color(Color::from_int(7), RGB::new(0xC2, 0xC3, 0xC7));
@firefly.set_color(Color::from_int(8), RGB::new(0xFF, 0xF1, 0xE8));
@firefly.set_color(Color::from_int(9), RGB::new(0xFF, 0x00, 0x4D));
@firefly.set_color(Color::from_int(10), RGB::new(0xFF, 0xA3, 0x00));
@firefly.set_color(Color::from_int(11), RGB::new(0xFF, 0xEC, 0x27));
@firefly.set_color(Color::from_int(12), RGB::new(0x00, 0xE4, 0x36));
@firefly.set_color(Color::from_int(13), RGB::new(0x29, 0xAD, 0xFF));
@firefly.set_color(Color::from_int(14), RGB::new(0x83, 0x76, 0x9C));
@firefly.set_color(Color::from_int(15), RGB::new(0xFF, 0x77, 0xA8));
@firefly.set_color(Color::from_int(16), RGB::new(0xFF, 0xCC, 0xAA));
}
🌙 Lua
function boot()
set_colors()
end
function set_colors()
-- https://lospec.com/palette-list/pico-8
firefly.set_color(1, {r=0x00, g=0x00, b=0x00});
firefly.set_color(2, {r=0x1D, g=0x2B, b=0x53});
firefly.set_color(3, {r=0x7E, g=0x25, b=0x53});
firefly.set_color(4, {r=0x00, g=0x87, b=0x51});
firefly.set_color(5, {r=0xAB, g=0x52, b=0x36});
firefly.set_color(6, {r=0x5F, g=0x57, b=0x4F});
firefly.set_color(7, {r=0xC2, g=0xC3, b=0xC7});
firefly.set_color(8, {r=0xFF, g=0xF1, b=0xE8});
firefly.set_color(9, {r=0xFF, g=0x00, b=0x4D});
firefly.set_color(10, {r=0xFF, g=0xA3, b=0x00});
firefly.set_color(11, {r=0xFF, g=0xEC, b=0x27});
firefly.set_color(12, {r=0x00, g=0xE4, b=0x36});
firefly.set_color(13, {r=0x29, g=0xAD, b=0xFF});
firefly.set_color(14, {r=0x83, g=0x76, b=0x9C});
firefly.set_color(15, {r=0xFF, g=0x77, b=0xA8});
firefly.set_color(16, {r=0xFF, g=0xCC, b=0xAA});
end