Palettes / JMP (Japanese Machine Palette)

JMP (Japanese Machine Palette)

"I wanted to do the MSX palette because it has some character. I suppose there aren't any "official" RGB colors for it though." -Arne Niklas Jansson

🦀 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/jmp-japanese-machine-palette
    set_color(Color::from(1), RGB::new(0x00, 0x00, 0x00));
    set_color(Color::from(2), RGB::new(0x19, 0x10, 0x28));
    set_color(Color::from(3), RGB::new(0x46, 0xaf, 0x45));
    set_color(Color::from(4), RGB::new(0xa1, 0xd6, 0x85));
    set_color(Color::from(5), RGB::new(0x45, 0x3e, 0x78));
    set_color(Color::from(6), RGB::new(0x76, 0x64, 0xfe));
    set_color(Color::from(7), RGB::new(0x83, 0x31, 0x29));
    set_color(Color::from(8), RGB::new(0x9e, 0xc2, 0xe8));
    set_color(Color::from(9), RGB::new(0xdc, 0x53, 0x4b));
    set_color(Color::from(10), RGB::new(0xe1, 0x8d, 0x79));
    set_color(Color::from(11), RGB::new(0xd6, 0xb9, 0x7b));
    set_color(Color::from(12), RGB::new(0xe9, 0xd8, 0xa1));
    set_color(Color::from(13), RGB::new(0x21, 0x6c, 0x4b));
    set_color(Color::from(14), RGB::new(0xd3, 0x65, 0xc8));
    set_color(Color::from(15), RGB::new(0xaf, 0xaa, 0xb9));
    set_color(Color::from(16), RGB::new(0xf5, 0xf4, 0xeb));
}

🏃 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/jmp-japanese-machine-palette
    firefly.SetColor(1, firefly.RGB{R: 0x00, G: 0x00, B: 0x00})
    firefly.SetColor(2, firefly.RGB{R: 0x19, G: 0x10, B: 0x28})
    firefly.SetColor(3, firefly.RGB{R: 0x46, G: 0xaf, B: 0x45})
    firefly.SetColor(4, firefly.RGB{R: 0xa1, G: 0xd6, B: 0x85})
    firefly.SetColor(5, firefly.RGB{R: 0x45, G: 0x3e, B: 0x78})
    firefly.SetColor(6, firefly.RGB{R: 0x76, G: 0x64, B: 0xfe})
    firefly.SetColor(7, firefly.RGB{R: 0x83, G: 0x31, B: 0x29})
    firefly.SetColor(8, firefly.RGB{R: 0x9e, G: 0xc2, B: 0xe8})
    firefly.SetColor(9, firefly.RGB{R: 0xdc, G: 0x53, B: 0x4b})
    firefly.SetColor(10, firefly.RGB{R: 0xe1, G: 0x8d, B: 0x79})
    firefly.SetColor(11, firefly.RGB{R: 0xd6, G: 0xb9, B: 0x7b})
    firefly.SetColor(12, firefly.RGB{R: 0xe9, G: 0xd8, B: 0xa1})
    firefly.SetColor(13, firefly.RGB{R: 0x21, G: 0x6c, B: 0x4b})
    firefly.SetColor(14, firefly.RGB{R: 0xd3, G: 0x65, B: 0xc8})
    firefly.SetColor(15, firefly.RGB{R: 0xaf, G: 0xaa, B: 0xb9})
    firefly.SetColor(16, firefly.RGB{R: 0xf5, G: 0xf4, B: 0xeb})
}

⚡️ Zig

const ff = @import("firefly");

pub export fn update() void {
    setColors()
}

fn setColors() void {
    // https://lospec.com/palette-list/jmp-japanese-machine-palette
    ff.setColor(@enumFromInt(1), ff.RGB{.r = 0x00, .g = 0x00, .b = 0x00});
    ff.setColor(@enumFromInt(2), ff.RGB{.r = 0x19, .g = 0x10, .b = 0x28});
    ff.setColor(@enumFromInt(3), ff.RGB{.r = 0x46, .g = 0xaf, .b = 0x45});
    ff.setColor(@enumFromInt(4), ff.RGB{.r = 0xa1, .g = 0xd6, .b = 0x85});
    ff.setColor(@enumFromInt(5), ff.RGB{.r = 0x45, .g = 0x3e, .b = 0x78});
    ff.setColor(@enumFromInt(6), ff.RGB{.r = 0x76, .g = 0x64, .b = 0xfe});
    ff.setColor(@enumFromInt(7), ff.RGB{.r = 0x83, .g = 0x31, .b = 0x29});
    ff.setColor(@enumFromInt(8), ff.RGB{.r = 0x9e, .g = 0xc2, .b = 0xe8});
    ff.setColor(@enumFromInt(9), ff.RGB{.r = 0xdc, .g = 0x53, .b = 0x4b});
    ff.setColor(@enumFromInt(10), ff.RGB{.r = 0xe1, .g = 0x8d, .b = 0x79});
    ff.setColor(@enumFromInt(11), ff.RGB{.r = 0xd6, .g = 0xb9, .b = 0x7b});
    ff.setColor(@enumFromInt(12), ff.RGB{.r = 0xe9, .g = 0xd8, .b = 0xa1});
    ff.setColor(@enumFromInt(13), ff.RGB{.r = 0x21, .g = 0x6c, .b = 0x4b});
    ff.setColor(@enumFromInt(14), ff.RGB{.r = 0xd3, .g = 0x65, .b = 0xc8});
    ff.setColor(@enumFromInt(15), ff.RGB{.r = 0xaf, .g = 0xaa, .b = 0xb9});
    ff.setColor(@enumFromInt(16), ff.RGB{.r = 0xf5, .g = 0xf4, .b = 0xeb});
}

🐀 C

#include "./vendor/firefly/firefly.c"

BOOT void boot()
{
    set_colors();
}

void set_colors()
{
    // https://lospec.com/palette-list/jmp-japanese-machine-palette
    RGB color1 = {0x00, 0x00, 0x00};
    set_color(1, color1);
    RGB color2 = {0x19, 0x10, 0x28};
    set_color(2, color2);
    RGB color3 = {0x46, 0xaf, 0x45};
    set_color(3, color3);
    RGB color4 = {0xa1, 0xd6, 0x85};
    set_color(4, color4);
    RGB color5 = {0x45, 0x3e, 0x78};
    set_color(5, color5);
    RGB color6 = {0x76, 0x64, 0xfe};
    set_color(6, color6);
    RGB color7 = {0x83, 0x31, 0x29};
    set_color(7, color7);
    RGB color8 = {0x9e, 0xc2, 0xe8};
    set_color(8, color8);
    RGB color9 = {0xdc, 0x53, 0x4b};
    set_color(9, color9);
    RGB color10 = {0xe1, 0x8d, 0x79};
    set_color(10, color10);
    RGB color11 = {0xd6, 0xb9, 0x7b};
    set_color(11, color11);
    RGB color12 = {0xe9, 0xd8, 0xa1};
    set_color(12, color12);
    RGB color13 = {0x21, 0x6c, 0x4b};
    set_color(13, color13);
    RGB color14 = {0xd3, 0x65, 0xc8};
    set_color(14, color14);
    RGB color15 = {0xaf, 0xaa, 0xb9};
    set_color(15, color15);
    RGB color16 = {0xf5, 0xf4, 0xeb};
    set_color(16, color16);
}

➕ C++

#include "./vendor/firefly/firefly.c"

BOOT void boot()
{
    set_colors();
}

void set_colors()
{
    // https://lospec.com/palette-list/jmp-japanese-machine-palette
    set_color(1, {0x00, 0x00, 0x00});
    set_color(2, {0x19, 0x10, 0x28});
    set_color(3, {0x46, 0xaf, 0x45});
    set_color(4, {0xa1, 0xd6, 0x85});
    set_color(5, {0x45, 0x3e, 0x78});
    set_color(6, {0x76, 0x64, 0xfe});
    set_color(7, {0x83, 0x31, 0x29});
    set_color(8, {0x9e, 0xc2, 0xe8});
    set_color(9, {0xdc, 0x53, 0x4b});
    set_color(10, {0xe1, 0x8d, 0x79});
    set_color(11, {0xd6, 0xb9, 0x7b});
    set_color(12, {0xe9, 0xd8, 0xa1});
    set_color(13, {0x21, 0x6c, 0x4b});
    set_color(14, {0xd3, 0x65, 0xc8});
    set_color(15, {0xaf, 0xaa, 0xb9});
    set_color(16, {0xf5, 0xf4, 0xeb});
}

🐰 MoonBit

///|
using @firefly {type Color, type RGB}

///|
pub fn boot() -> Unit {
  set_colors()
}

///|
fn set_colors() -> Unit {
  // https://lospec.com/palette-list/jmp-japanese-machine-palette
  @firefly.set_color(Color::from_int(1), RGB::new(0x00, 0x00, 0x00));
  @firefly.set_color(Color::from_int(2), RGB::new(0x19, 0x10, 0x28));
  @firefly.set_color(Color::from_int(3), RGB::new(0x46, 0xaf, 0x45));
  @firefly.set_color(Color::from_int(4), RGB::new(0xa1, 0xd6, 0x85));
  @firefly.set_color(Color::from_int(5), RGB::new(0x45, 0x3e, 0x78));
  @firefly.set_color(Color::from_int(6), RGB::new(0x76, 0x64, 0xfe));
  @firefly.set_color(Color::from_int(7), RGB::new(0x83, 0x31, 0x29));
  @firefly.set_color(Color::from_int(8), RGB::new(0x9e, 0xc2, 0xe8));
  @firefly.set_color(Color::from_int(9), RGB::new(0xdc, 0x53, 0x4b));
  @firefly.set_color(Color::from_int(10), RGB::new(0xe1, 0x8d, 0x79));
  @firefly.set_color(Color::from_int(11), RGB::new(0xd6, 0xb9, 0x7b));
  @firefly.set_color(Color::from_int(12), RGB::new(0xe9, 0xd8, 0xa1));
  @firefly.set_color(Color::from_int(13), RGB::new(0x21, 0x6c, 0x4b));
  @firefly.set_color(Color::from_int(14), RGB::new(0xd3, 0x65, 0xc8));
  @firefly.set_color(Color::from_int(15), RGB::new(0xaf, 0xaa, 0xb9));
  @firefly.set_color(Color::from_int(16), RGB::new(0xf5, 0xf4, 0xeb));
}

🌙 Lua

function boot()
  set_colors()
end

function set_colors()
  -- https://lospec.com/palette-list/jmp-japanese-machine-palette
  firefly.set_color(1, {r=0x00, g=0x00, b=0x00});
  firefly.set_color(2, {r=0x19, g=0x10, b=0x28});
  firefly.set_color(3, {r=0x46, g=0xaf, b=0x45});
  firefly.set_color(4, {r=0xa1, g=0xd6, b=0x85});
  firefly.set_color(5, {r=0x45, g=0x3e, b=0x78});
  firefly.set_color(6, {r=0x76, g=0x64, b=0xfe});
  firefly.set_color(7, {r=0x83, g=0x31, b=0x29});
  firefly.set_color(8, {r=0x9e, g=0xc2, b=0xe8});
  firefly.set_color(9, {r=0xdc, g=0x53, b=0x4b});
  firefly.set_color(10, {r=0xe1, g=0x8d, b=0x79});
  firefly.set_color(11, {r=0xd6, g=0xb9, b=0x7b});
  firefly.set_color(12, {r=0xe9, g=0xd8, b=0xa1});
  firefly.set_color(13, {r=0x21, g=0x6c, b=0x4b});
  firefly.set_color(14, {r=0xd3, g=0x65, b=0xc8});
  firefly.set_color(15, {r=0xaf, g=0xaa, b=0xb9});
  firefly.set_color(16, {r=0xf5, g=0xf4, b=0xeb});
end