gamebeye.gbcamcolors module

The current gamebeye.gbcamcolors manage colors, palettes and all stuff related to process images color. The selection of color palettes is picked and adapted from HerrZatacke gb-printer-web.

The color_helpers module gather basic color conversion methods.

Thoses colors allowed me to make this small animation :

Animated GIF made of colorized images

Animated GIF made of colorized images

GBColorValues class

class gamebeye.gbcamcolors.gbcolorvalues.GBColorValues(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

Pre-defined colorsbased upon Game Boy Camera known palettes.

The GBColorValues class inherits from Enum class where the keys are the color names and the value a string whose value represent a color coded in hexadecimal basis.

ACAPULCO_DIVE = '#6F9EDF'

Acapulco of smoke color

ADIRONDACK_BLUE = '#75868F'

Adirondack blue color

AGED_ANTICS = '#846B29'

Aged antics color

ANCHOR_GREY = '#586164'

Anchor grey color

ANGELS_TRUMPET = '#F5DB37'

Angel's trumpet color

AQUA_RAPIDS = '#65A49B'

Aqua rapids color

ASTROTURF = '#649A57'

Astroturf color

BATS_CLOAK = '#1D1414'

Bats cloak color

BLACK = '#000000'

Black color

BLACK_BOX = '#102533'

Black box color

BLACK_POWDER = '#323727'

Black powder color

BLACK_SLUG = '#2C2410'

Black slug color

BLACK_STALLION = '#081820'

Black stallion color

BLAZE = '#F78E50'

Blaze color

BLEACHED_CEDAR = '#2F1C35'

Bleached cedar color

BLUE = '#0000FE'

Blue color

BLUE_GREEN = '#0B7A6D'

Blue green color

BLUE_JEANS = '#5FB1F5'

Blue jeans color

BLUSHING_CINNAMON = '#FFBF98'

Blushing cinnamon color

BRACKEN_FERN = '#2E463D'

Bracken fern color

BRILLIANT_LIQUORICE = '#545454'

Brilliant liquorice color

BRILLIANT_SILVER = '#A9B0B3'

Brilliant silver color

BUTTER_CAKE = '#FCFE54'

Butter cake color

CACODEMON_RED = '#9E0000'

Cacodemon red color

CALAMANSI = '#FFFFA5'

Calamansi color

CANDLELIGHT = '#FEDA1B'

Candlelight color

CANNON_BLACK = '#241606'

Cannon black color

CARMINE_ROSE = '#E65790'

Carmine rose color

CASSANDRAS_CURSE = '#C27600'

Cassandra's curse color

CAVERNOUS = '#525252'

Cavernous color

CERAMIC_BLUE_TURQUOISE = '#16A596'

Ceramic blue turquoise color

CERISE = '#B01553'

Cerise color

CHERISHED_ONE = '#FE9494'

Cherished one color

CHEROKEE_DIGNITY = '#DF7925'

Cherokee dignity color

CHESS_IVORY = '#FFE7C5'

Chess ivory color

CHESTNUT_SHELL = '#B5FF32'

Chestnut shell color

CHICON = '#DBF4B4'

Chicon color

CIDER_PEAR_GREEN = '#8B956D'

Cider pear green color

CINAMON = '#D5690F'

Cinamon color

CIRCUMORBITAL_RING = '#6D53BD'

Circumorbital ring color

COFFEE_ADDICTION = '#833100'

Coffer addiction color

COSMIC_VOID = '#0B0630'

Cosmic void color

COUNT_CHOCULA = '#5B3109'

Count chocula color

CREME = '#FFFFB5'

Crème color

CREME_FRAICHE = '#EBEEE7'

Crème fraîche color

DAHLIA_PURPLE = '#8570B2'

Dahlia purple color

DAPPLED_DAYDREAM = '#C4CFA1'

Dappled daydream color

DARK_ECLIPSE = '#0E1E3D'

Dark eclipse color

DARK_GREY = '#373737'

Dark grey color

DARK_MAHOGANY = '#4C1C2D'

Dark mahogany color

DARK_SIENNA = '#3F1711'

Dark sienna color

DEEP_SPACE_RODEO = '#382977'

Deep space rodeo color

DESERT_FLOWER = '#FF8F84'

Desert flower color

DREAMY_SUNSET = '#FFAD63'

Dreamy sunset color

DRIED_MUSTARD = '#7D4900'

Dried mustard color

DUSTY_CORAL = '#CE9C85'

Dusty coral color

DWARF_FORTRESS = '#1E0000'

Dwarf fortress color

EARLY_SPRING_NIGHT = '#3C3CA9'

Early spring night color

ELECTRIC_SHEEP = '#55FFFF'

Electric sheep color

ELWYNN_FOREST_OLIVE = '#7E8416'

Elwynn forest olive color

EMERALD_CLEAR_GREEN = '#558429'

Emerald clear green color

EXQUISITE_TURQUOISE = '#19C7B3'

Exquisite turquoise color

EYE_POPPING_CHERRY = '#B60077'

Eye popping cherry color

FANCY_FUCHSIA = '#FF0084'

Fancy fuchsia color

FANFARE = '#008486'

Fanfare color

FANTASY_CONSOLE_SKY = '#21AFF5'

Fantasy console sky color

FIJI = '#04AAAC'

Fiji color

FLAT_ALUMINIUM = '#C5C5CE'

Flat aluminium color

FLAXSEED = '#F7E7C6'

Flaxseed color

FLIRTATIOUS = '#FED638'

Flirtatious color

FLUORESCENT_RED = '#FF5555'

Fluorescent red color

FOREST_EMPRESS = '#467818'

Forest empress color

FREEZY_WIND = '#9EFBE3'

Freezy wind color

FRESH_HERBS = '#385D49'

Fresh herbs color

FROSTBITE = '#ADFFFC'

Frostbite color

FUCHSIA_NEBULA = '#6B1FB1'

Fuchsia nebula color

GAMEBOY_CONTRAST = '#0F380F'

GameBoy constrast color

GAMEBOY_LIGHT = '#9BBC0F'

GameBoy light color

GAMEBOY_SHADE = '#306230'

GameBoy shade color

GARDEN_STROLL = '#7BC67B'

Garden stroll color

GIBRALTAR_GREY = '#706B66'

Gibraltar grey color

GLAZED_SUGAR = '#FFDBCB'

Glazed sugar color

GODZILLA = '#405010'

Godzilla color

GOLDEN_GLOVE = '#9E754F'

Golden glove color

GOLDEN_NUGGET = '#D68E49'

Golden nugget color

GOLDEN_YELLOW = '#FFDE00'

Golden yellow color

GRANITA = '#B62558'

Granita color

GREEN_WATERLOO = '#2B2B26'

Green Waterloo color

GRIM_REAPER = '#0C0A3E'

Grim reaper color

HEXOS_PALESUN = '#FDFE0A'

Hexos palesun color

HINT_OF_YELLOW = '#FCF1CD'

Hint of yellow color

HYPER_GREEN = '#51FF00'

Hyper green color

ICE_CLIMBER = '#1DDECE'

Ice climber color

ILVAITE_BLACK = '#380016'

Ilvaite black color

INOFFENSIVE_BLUE = '#123F77'

Inoffesive blue color

JAIPUR = '#A63725'

Jaipur color

JINZA_SAFFLOWER = '#F27D7A'

Jinza safflower color

KELP = '#4D533C'

Kelp color

KOSHER_KHAHI = '#868779'

Kosher khaki color

KURO_BROWN = '#5A3921'

Kuro brown color

KYOTO_HOUSE = '#4F3000'

Kyoto house color

LAKE_THUN = '#37CAE5'

Lake thun color

LAUDABLE_LIME = '#88C070'

Laudable lime color

LAZY_LIZARD = '#A0A840'

Lazy lizard color

LIGHT_GREEN_GLINT = '#E0F8D0'

Light green glint color

LIQUORICE_ROOT = '#222903'

Liquorice root color

LODEN_FROST = '#7B9278'

Loden frost color

LONDON_STONES = '#A89F94'

London stone color

LUCARIO_BLUE = '#0F86B6'

Lucario blue color

LUMINESCENT_GREEN = '#77A112'

Luminescent green color

MADRILENO_MAROON = '#8F0039'

Madrileno maroon color

MAKRUT_LIME = '#6B8C42'

Makrut lime color

MANDARIN_PEEL = '#FF9C00'

Mandarin peel color

MELON_TWIST = '#A96868'

Melon twitst color

MILK = '#FDFEF5'

Milk color

MIZUKAZE_GREEN = '#124127'

Mizukaze green color

MOONGLOW = '#F8E3C4'

Moonglow color

MOON_WHITE = '#EAF5FA'

Moon white color

MOOSE_FUR = '#725441'

Moose fur color

MOSSY_GREEN = '#577B46'

Mossy green color

MYRTLE = '#27421F'

Myrtle color

NEW_SLED = '#943A3A'

New sled color

NIGHT_BROWN = '#462917'

Night brown color

NOBLE_CREAM = '#E0DBCD'

Noble cream color

NOIR_MYSTIQUE = '#221A09'

Noir mystique color

NUIT_BLANCHE = '#1E4793'

Nuit blanche color

OK_CORRAL = '#CF7163'

OK corral color

OLD_TREASURE_CHEST = '#574431'

Old treasure chest color

ORANGE_CHOCOLATE = '#F3C677'

orange chocolate color

ORB_OF_DISCORD = '#6F2096'

Orb of discord color

PAINT_THE_SKY = '#0BE8FD'

Paint the sky color

PANGO_BLACK = '#514F6C'

Pango black color

PEEVISH_RED = '#FF2261'

Peevish red color

PERRYWINKLE = '#8B8CDE'

Perrywinkle color

PERRYWINKLE_BLUE = '#9395FE'

Periwinkle blue color

PESTO_DI_RUCOLA = '#708028'

Pesto di rucola color

PILA_YELLOW = '#FFFF55'

Pîlâ yellow color

PINK_MACAROON = '#E6AEC4'

Pink macaroon color

PLANTAIN_GREEN = '#346856'

Plantain green color

POLO_PONY = '#CF9255'

Polo pony color

PORTAGE = '#869AD9'

Portage color

POWERFUL_VIOLET = '#331E50'

Powerful violet color

PURE_MIDNIGHT = '#171F62'

Pure pidnight color

PURPLE_DREAMER = '#68006A'

Purple dreamer color

RAINY_GREY = '#A5A5A5'

Rainy grey color

RED = '#FF0000'

Red color

RED_LEEVER = '#881400'

Red leever color

RED_PEGASUS = '#DB0000'

Red pegasus color

RED_STOP = '#FA2B25'

Red stop color

RIDGE_VIEW = '#A1A8B8'

Ridge view color

ROYAL_FUCHSIA = '#CC3495'

Royal fuchsia color

ROYAL_NAVY_BLUE = '#0163C6'

Royal navy blue color

SALSA_VERDE = '#D0D058'

Salsa verde color

SCINTILLATING_VIOLET = '#764462'

Scintillating violet color

SEAWASHED_GLASS = '#ABC396'

Seawashed glass color

SEA_GREEN = '#47FF99'

Sea green color

SEA_OF_GALILEE = '#42678E'

Sea of Galilee color

SHORELAND = '#E9D9CC'

Shoreland color

SIXTEEN_MILLION_PINK = '#FB00FA'

Sixteen million pink color

SMOOCH_ROUGE = '#D23C4E'

Smooch rouge color

SPANISH_VIRIDIAN = '#047E60'

Spanish viridian color

SPRING_FROST = '#7BFF30'

Spring frost color

SPRUCED_UP = '#977B25'

Spruced up color

SUGAR_HONEY_CASHEW = '#DEA963'

Sugar honey cashew color

SUPER_BANANA = '#FFFE6E'

Super banana color

THIMBLEBERRY = '#E64A4E'

Thimbleberry color

TINTED_ICE = '#CEF7F7'

Tinted ice color

TRADITIONAL_ROYAL_BLUE = '#0402AC'

Traditional royal blue color

TURTLE_WARRIOR = '#32B66D'

Turtle warrior color

TWILIGHT = '#53528C'

Twilight color

ULTIMATE_ORANGE = '#FF4200'

Ultimate orange color

ULTIMATE_PINK = '#FF55FF'

Ultimate pink color

UMBRA = '#1F1F1F'

Umbra color

UMBRAL_UMBER = '#520000'

Umbral umber color

UNIFORM_GREY = '#A8A8A8'

Uniform grey color

VELCET_BLACK = '#2A201E'

Velvet black color

VERT_PIERRE = '#4C625A'

Vert pierre color

VIOLET_CARMINE = '#4F133F'

Violet carmine color

VIOLET_VIXEN = '#912978'

Violet vixen color

VIVID_LIME_GREEN = '#A1D909'

Vivid lime green color

VOID = '#030C22'

Void color

WAX_FLOWER = '#EDB4A1'

Wax flower color

WEEKEND_RETREAT = '#EBC4AB'

Weekend retreat color

WHISPER_OF_SMOKE = '#CECECE'

Whisper of smoke color

WHITE = '#FFFFFF'

White color

WICKERWORK = '#C09E7D'

Wickerork color

YANKEES_BLUE = '#20293F'

Yankees blue color

YELLOW = '#FFFF00'

Yellow color

YELLOWISH_GREEN = '#AEDF1E'

Yellowish green color

ZINNWALDITE_BROWN = '#2C1700'

Zinnwaldite brown color

describe() Tuple[str, list]

Describe itself. Return as a tuple the color palette name and colors.

Returns:

a 2-values tuple containing the color name and its values

Return type:

str, list

>>> from gamebeye.gbcamcolors.gbcolorvalues import GBColorValues
>>> GBcolorValues.ROYAL_NAVY_BLUE.describe()
('ROYAL_NAVY_BLUE', '#0163C6')
distance_from(rgb_value: list[int])

Compute the deltaE_ciede2000 between the current color from a (R, G, B) array.

Parameters:

rgb_value (list) – (R, G, B) list of reference

Returns:

the color distance

Return type:

float

classmethod nearest_color(rgb_value)

Find nearest color value among the GBColorValues.

Parameters:

rgb_val (list) – (R, G, B) list to convert

Returns:

the nearest color from the GBColorValues

Return type:

GBColorValue

>>> from gamebeye.gbcamcolors.gbcolorvalues import GBColorValues
>>> GBColorValues.nearest_color([2, 100, 198])
<GBColorValues.ROYAL_NAVY_BLUE: '#0163C6'>
static nearest_color_in(gb_color_values: List[Self], rgb_value: List[int])

Find nearest color value among a list of GBColorValues.

Parameters:

rgb_val (list) – (R, G, B) list to convert

Returns:

the nearest color from the GBColorValues

Return type:

GBColorValue

property rgb_colors: List[int]

Return the the color value of the enum in RGB space.

Returns:

the color values in the RGB space

Return type:

list[int]

>>> from gamebeye.gbcamcolors.gbcolorvalues import GBColorValues
>>> GBColorValues.ROYAL_NAVY_BLUE
[1, 99, 198]

GBColorPalettes class

class gamebeye.gbcamcolors.gbcolorpalettes.GBColorPalettes(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

56 Pre-defined color palettes based upon Game Boy Camera known palettes.

The GBColorPalettes class inherits from Enum class where the keys are the color palette names and the valuea 4 elements array whose values represent a color coded in hexadecimal basis.

AQPP = [GBColorValues.CREME_FRAICHE, GBColorValues.KOSHER_KHAHI, GBColorValues.RED_STOP, GBColorValues.VELCET_BLACK]

AQPP color palette

AZC = [GBColorValues.SEA_GREEN, GBColorValues.TURTLE_WARRIOR, GBColorValues.MIZUKAZE_GREEN, GBColorValues.BLACK]

AZC color palette

BANANA = [GBColorValues.HEXOS_PALESUN, GBColorValues.FLIRTATIOUS, GBColorValues.SPRUCED_UP, GBColorValues.NOIR_MYSTIQUE]

BANANA color palette

BGB = [GBColorValues.LIGHT_GREEN_GLINT, GBColorValues.LAUDABLE_LIME, GBColorValues.PLANTAIN_GREEN, GBColorValues.BLACK_STALLION]

BGB color palette

BLACKZERO = [GBColorValues.ELWYNN_FOREST_OLIVE, GBColorValues.MOSSY_GREEN, GBColorValues.FRESH_HERBS, GBColorValues.BRACKEN_FERN]

BLACKZERO color palette

BW = [GBColorValues.WHITE, GBColorValues.UNIFORM_GREY, GBColorValues.BRILLIANT_LIQUORICE, GBColorValues.BLACK]

BW color palette

CCTR = [GBColorValues.PINK_MACAROON, GBColorValues.CARMINE_ROSE, GBColorValues.MADRILENO_MAROON, GBColorValues.ILVAITE_BLACK]

CCTR color palette

CFP = [GBColorValues.POLO_PONY, GBColorValues.OK_CORRAL, GBColorValues.CERISE, GBColorValues.DARK_SIENNA]

CFP color palette

CGA1 = [GBColorValues.WHITE, GBColorValues.ELECTRIC_SHEEP, GBColorValues.ULTIMATE_PINK, GBColorValues.BLACK]

CGA1 color palette

CGA2 = [GBColorValues.WHITE, GBColorValues.ELECTRIC_SHEEP, GBColorValues.FLUORESCENT_RED, GBColorValues.BLACK]

CGA2 color palette

CHIG = [GBColorValues.SALSA_VERDE, GBColorValues.LAZY_LIZARD, GBColorValues.PESTO_DI_RUCOLA, GBColorValues.GODZILLA]

CHIG color palette

CMYK = [GBColorValues.YELLOW, GBColorValues.PAINT_THE_SKY, GBColorValues.SIXTEEN_MILLION_PINK, GBColorValues.DARK_GREY]

CMYK color palette

CYBL = [GBColorValues.FREEZY_WIND, GBColorValues.FANTASY_CONSOLE_SKY, GBColorValues.NUIT_BLANCHE, GBColorValues.DARK_ECLIPSE]

CYBL color palette

D2KR = [GBColorValues.HINT_OF_YELLOW, GBColorValues.WICKERWORK, GBColorValues.MOOSE_FUR, GBColorValues.BLACK]

D2KR color palette

DATN = [GBColorValues.BRILLIANT_SILVER, GBColorValues.ANCHOR_GREY, GBColorValues.YANKEES_BLUE, GBColorValues.VOID]

DATN color palette

DHG = [GBColorValues.VIVID_LIME_GREEN, GBColorValues.FOREST_EMPRESS, GBColorValues.MYRTLE, GBColorValues.BLACK]

DHG color palette

DIMWM = [GBColorValues.GLAZED_SUGAR, GBColorValues.JINZA_SAFFLOWER, GBColorValues.EMERALD_CLEAR_GREEN, GBColorValues.LIQUORICE_ROOT]

DIMWM color palette

DMG = [GBColorValues.GAMEBOY_LIGHT, GBColorValues.LUMINESCENT_GREEN, GBColorValues.GAMEBOY_SHADE, GBColorValues.GAMEBOY_CONTRAST]

DMG color palette

FFS = [GBColorValues.SHORELAND, GBColorValues.FLAT_ALUMINIUM, GBColorValues.ADIRONDACK_BLUE, GBColorValues.PURE_MIDNIGHT]

FFS color palette

FSIL = [GBColorValues.MOON_WHITE, GBColorValues.BLUE_JEANS, GBColorValues.SMOOCH_ROUGE, GBColorValues.DARK_MAHOGANY]

FSIL color palette

GBCD = [GBColorValues.CALAMANSI, GBColorValues.CHERISHED_ONE, GBColorValues.PERRYWINKLE_BLUE, GBColorValues.BLACK]

GBCD color palette

GBCDA = [GBColorValues.WHITE, GBColorValues.YELLOW, GBColorValues.RED, GBColorValues.BLACK]

GBCDA color palette

GBCDB = [GBColorValues.WHITE, GBColorValues.YELLOW, GBColorValues.DRIED_MUSTARD, GBColorValues.BLACK]

GBCDB color palette

GBCEUUS = [GBColorValues.WHITE, GBColorValues.SPRING_FROST, GBColorValues.ROYAL_NAVY_BLUE, GBColorValues.BLACK]

GBCEUUS color palette

GBCJP = [GBColorValues.WHITE, GBColorValues.DREAMY_SUNSET, GBColorValues.COFFEE_ADDICTION, GBColorValues.BLACK]

GBCJP color palette

GBCL = [GBColorValues.WHITE, GBColorValues.AQUA_RAPIDS, GBColorValues.BLUE, GBColorValues.BLACK]

GBCL color palette

GBCLA = [GBColorValues.WHITE, GBColorValues.PERRYWINKLE, GBColorValues.TWILIGHT, GBColorValues.BLACK]

GBCLA color palette

GBCLB = [GBColorValues.WHITE, GBColorValues.RAINY_GREY, GBColorValues.CAVERNOUS, GBColorValues.BLACK]

GBCLB color palette

GBCR = [GBColorValues.WHITE, GBColorValues.HYPER_GREEN, GBColorValues.ULTIMATE_ORANGE, GBColorValues.BLACK]

GBCR color palette

GBCRB = [GBColorValues.BLACK, GBColorValues.FANFARE, GBColorValues.GOLDEN_YELLOW, GBColorValues.WHITE]

GBCRB color palette

GBCUA = [GBColorValues.WHITE, GBColorValues.DESERT_FLOWER, GBColorValues.NEW_SLED, GBColorValues.BLACK]

GBCUA color palette

GBCUC = [GBColorValues.CHESS_IVORY, GBColorValues.DUSTY_CORAL, GBColorValues.AGED_ANTICS, GBColorValues.COUNT_CHOCULA]

GBCUC color palette

GBLIT = [GBColorValues.ICE_CLIMBER, GBColorValues.EXQUISITE_TURQUOISE, GBColorValues.CERAMIC_BLUE_TURQUOISE, GBColorValues.BLUE_GREEN]

GBLIT color palette

GBPOCKET = [GBColorValues.DAPPLED_DAYDREAM, GBColorValues.CIDER_PEAR_GREEN, GBColorValues.KELP, GBColorValues.UMBRA]

GBPOCKET color palette

GELC = [GBColorValues.MANDARIN_PEEL, GBColorValues.CASSANDRAS_CURSE, GBColorValues.KYOTO_HOUSE, GBColorValues.BLACK]

GELC color palette

GLMO = [GBColorValues.BLUSHING_CINNAMON, GBColorValues.RIDGE_VIEW, GBColorValues.PANGO_BLACK, GBColorValues.BLEACHED_CEDAR]

GLMO color palette

GRAFIXKIDGRAY = [GBColorValues.NOBLE_CREAM, GBColorValues.LONDON_STONES, GBColorValues.GIBRALTAR_GREY, GBColorValues.GREEN_WATERLOO]

GRAFIXKIDGRAY color palette

GRAFIXKIDGREEN = [GBColorValues.CHICON, GBColorValues.SEAWASHED_GLASS, GBColorValues.LODEN_FROST, GBColorValues.VERT_PIERRE]

GRAFIXKIDGREEN color palette

HIPSTER = [GBColorValues.MILK, GBColorValues.SUGAR_HONEY_CASHEW, GBColorValues.GOLDEN_GLOVE, GBColorValues.CANNON_BLACK]

HIPSTER color palette

KDITW = [GBColorValues.SUPER_BANANA, GBColorValues.CINAMON, GBColorValues.EARLY_SPRING_NIGHT, GBColorValues.BLACK_SLUG]

KDITW color palette

LLAWK = [GBColorValues.CREME, GBColorValues.GARDEN_STROLL, GBColorValues.MAKRUT_LIME, GBColorValues.KURO_BROWN]

LLAWK color palette

MARMX = [GBColorValues.YELLOWISH_GREEN, GBColorValues.SPANISH_VIRIDIAN, GBColorValues.GRANITA, GBColorValues.ZINNWALDITE_BROWN]

MARMX color palette

NC = [GBColorValues.BUTTER_CAKE, GBColorValues.ELECTRIC_SHEEP, GBColorValues.FIJI, GBColorValues.TRADITIONAL_ROYAL_BLUE]

NC color palette

PPR = [GBColorValues.FROSTBITE, GBColorValues.DAHLIA_PURPLE, GBColorValues.FANCY_FUCHSIA, GBColorValues.PURPLE_DREAMER]

PPR color palette

RCS = [GBColorValues.WAX_FLOWER, GBColorValues.MELON_TWIST, GBColorValues.SCINTILLATING_VIOLET, GBColorValues.BLEACHED_CEDAR]

RCS color palette

ROGA = [GBColorValues.WEEKEND_RETREAT, GBColorValues.ASTROTURF, GBColorValues.OLD_TREASURE_CHEST, GBColorValues.BLACK_POWDER]

ROGA color palette

SFH = [GBColorValues.PILA_YELLOW, GBColorValues.FLUORESCENT_RED, GBColorValues.RED_LEEVER, GBColorValues.BLACK]

SFH color palette

SHMGY = [GBColorValues.FLAXSEED, GBColorValues.GOLDEN_NUGGET, GBColorValues.JAIPUR, GBColorValues.POWERFUL_VIOLET]

SHMGY color palette

SHZOL = [GBColorValues.MOONGLOW, GBColorValues.ROYAL_FUCHSIA, GBColorValues.FUCHSIA_NEBULA, GBColorValues.COSMIC_VOID]

SHZOL color palette

SLMEM = [GBColorValues.PORTAGE, GBColorValues.CIRCUMORBITAL_RING, GBColorValues.ORB_OF_DISCORD, GBColorValues.VIOLET_CARMINE]

SLMEM color palette

SPEZI = [GBColorValues.CANDLELIGHT, GBColorValues.CHEROKEE_DIGNITY, GBColorValues.EYE_POPPING_CHERRY, GBColorValues.DEEP_SPACE_RODEO]

SPEZI color palette

TDOYC = [GBColorValues.CHESTNUT_SHELL, GBColorValues.PEEVISH_RED, GBColorValues.NIGHT_BROWN, GBColorValues.BATS_CLOAK]

TDOYC color palette

TPA = [GBColorValues.ORANGE_CHOCOLATE, GBColorValues.THIMBLEBERRY, GBColorValues.VIOLET_VIXEN, GBColorValues.GRIM_REAPER]

TPA color palette

TSK = [GBColorValues.ANGELS_TRUMPET, GBColorValues.LAKE_THUN, GBColorValues.LUCARIO_BLUE, GBColorValues.INOFFENSIVE_BLUE]

TSK color palette

VB85 = [GBColorValues.RED, GBColorValues.RED_PEGASUS, GBColorValues.UMBRAL_UMBER, GBColorValues.BLACK]

VB85 color palette

WTFP = [GBColorValues.WHISPER_OF_SMOKE, GBColorValues.ACAPULCO_DIVE, GBColorValues.SEA_OF_GALILEE, GBColorValues.BLACK_BOX]

WTFP color palette

YIRL = [GBColorValues.TINTED_ICE, GBColorValues.BLAZE, GBColorValues.CACODEMON_RED, GBColorValues.DWARF_FORTRESS]

YIRL color palette

static convert_to_palette(img_rgb_palette: List[List[int]], gbcolorpalette: Self = None) Dict[List[int], GBColorValues]

Convert a RGB color to the nearest GBColorValue from a GBColorPalette.

Parameters:
  • img_rgb_palette (list) – list of rgb colors

  • gbcolorpalette (GBColorPalettes) – the color palette destination

Returns:

a color conversion map

Return type:

ColorMap

describe() Tuple[str, list]

Describe itself. Return as a tuple the color palette name and colors.

Returns:

a 2-values tuple containing the color name and its values

Return type:

str, list

>>> from gamebeye.gbcamcolors.gbcolorpalettes import GBColorPalettes
>>> GBColorPalettes.BW.describe()
('BW', ['#FFFFFF', '#A8A8A8', '#545454', '#000000'])
distance_from(rgb_values: List[List[int]])

Compute the deltaE_ciede2000 between the palette from a colors list.

Parameters:

rgb_values (list) – (R, G, B) colors

Returns:

the color distance

Return type:

float

property hex_colors: List[str]

Return the 4 color values of the enum in hexadecimal.

Returns:

the 4 colors values in hexadecimal.

Return type:

list[str]

>>> from gamebeye.gbcamcolors.gbcolorpalettes import GBColorPalettes
>>> GBColorPalettes.BW.hex_colors
['#FFFFFF', '#A8A8A8', '#545454', '#000000']
classmethod nearest_palette(img_rgb_palette: List[List[int]])

Find nearest color palette among the GBColorPalettes.

Parameters:

rgb_color_palette (list[list[int]]) – a color palette

Returns:

the nearest color palette from GBColorPalettes

Return type:

GBColorPalettes

property rgb_colors: List[List[int]]

Return the 4 color values of the enum in RGB space.

Returns:

the 4 colors values in the RGB space

Return type:

list[list[int]]

>>> from gamebeye.gbcamcolors.gbcolorpalettes import GBColorPalettes
>>> GBColorPalettes.BW.rgb_colors
[[255, 255, 255], [168, 168, 168], [84, 84, 84], [0, 0, 0]]

color_helpers module

Define color conversions and methods related to 8-bits colorspaces.

gamebeye.gbcamcolors.color_helpers.bgr_to_hex(bgr_val: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) str

Convert a (B, G, R) array to hexadecimal integer.

All values are clamped between 0 and 255.

Parameters:

bgr_val (list) – (B, G, R) to convert

Raises:

ValueError – rgb_val argument must be a 3 values list

Returns:

an hexadecimal value

Return type:

str

>>> from gamebeye.gbcamcolors.color_helpers import bgr_to_hex
>>> bgr_to_hex([0, 0, 0])
'#000000'
>>> bgr_to_hex([0, 0, 255])
'#FF0000'
>>> bgr_to_hex([255, 0, 0])
'#0000FF'
>>> bgr_to_hex([512, 128, 0])
'#0080FF'
>>> bgr_to_hex([0, 0, 0, 0])
Traceback (most recent call last):
    ...
ValueError: bgr_val argument must be a 3 values list
gamebeye.gbcamcolors.color_helpers.bgr_to_rgb(bgr_val: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) ndarray

Convert a (B, G, R) array to a (R, G, B) array.

All values are clamped between 0 and 255.

Parameters:

bgr_val (list) – (B, G, R) to convert

Raises:

ValueError – bgr_val argument must be a 3 values list

Returns:

a list containing R, G, B values.

Return type:

a list of integer

>>> from gamebeye.gbcamcolors.color_helpers import bgr_to_hex
>>> bgr_to_hex([0, 0, 0])
'#000000'
>>> bgr_to_hex([0, 0, 255])
'#FF0000'
>>> bgr_to_hex([255, 0, 0])
'#0000FF'
>>> bgr_to_hex([512, 128, 0])
'#0080FF'
>>> bgr_to_hex([0, 0, 0, 0])
Traceback (most recent call last):
    ...
ValueError: bgr_val argument must be a 3 values list
gamebeye.gbcamcolors.color_helpers.clamp(val: int) int

Ensure that val is between 0 and 255.

Clamp each out of bound value.

Parameters:

val (int) – an int value

Returns:

the clamped value

Return type:

int

>>> from gamebeye.gbcamcolors.color_helpers import clamp
>>> clamp(-125)
0
>>> clamp(0)
0
>>> clamp(125)
125
>>> clamp(255)
255
>>> clamp(512)
255
gamebeye.gbcamcolors.color_helpers.clamp_hex(hex_val: str) str

Ensure that val is between ‘0x000000’ and ‘0xFFFFFF’.

Clamp each out of bound value.

Parameters:

hex_val (str) – an hexadecimal string value

Returns:

the hex clamped value

Return type:

str

>>> from gamebeye.gbcamcolors.color_helpers import clamp_hex
>>> clamp_hex('#000000')
'#000000'
>>> clamp_hex('#FFFFFF')
'#FFFFFF'
>>> clamp_hex('#00FF00')
'#00FF00'
>>> clamp_hex('#F000000')
'#FFFFFF'
gamebeye.gbcamcolors.color_helpers.clamp_rgb(rgb_val: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) ndarray

Ensure that all RGB values are between 0 and 255.

Clamp each out of bound value.

Parameters:

rgb_val (List[int]) – 3-channels list for R, G, B

Raises:

ValueError – rgb_val argument must be a 3 values list

Returns:

the clamped list

Return type:

List[int]

>>> from gamebeye.gbcamcolors.color_helpers import clamp_rgb
>>> clamp_rgb([0, 0, 0])
[0, 0, 0]
>>> clamp_rgb([255, 255, 255])
[255, 255, 255]
>>> clamp_rgb([512, 0, 0])
[255, 0, 0]
>>> clamp_rgb([255, 255, 255, 0])
Traceback (most recent call last):
    ...
ValueError: rgb_val argument must be a 3 values list
gamebeye.gbcamcolors.color_helpers.hex_to_bgr(hex_val: str) ndarray

Convert a hexadecimal value to BGR values.

All values are clamped between 0 and 255.

The 2 left digits code the green value, the 2 middle digits the blue and the 2 left digits the red.

Parameters:

hex_val (str) – hexadecimal value.

Returns:

a list containing B, G, R values

Return type:

a list of integer

>>> from gamebeye.gbcamcolors.color_helpers import hex_to_bgr
>>> hex_to_bgr('#000000')
[0, 0, 0]
>>> hex_to_bgr('#FF0000')
[0, 0, 255]
>>> hex_to_bgr('#00FF00')
[0, 255, 0]
>>> hex_to_bgr('#0000FF')
[255, 0, 0]
>>> hex_to_bgr('#FFFFFF')
[255, 255, 255]
>>> hex_to_bgr('#F000000')
[255, 255, 255]
gamebeye.gbcamcolors.color_helpers.hex_to_rgb(hex_val: str) ndarray

Convert a hexadecimal value to RGB values.

All values are clamped between 0 and 255.

The 2 left digits code the red value, the 2 middle digits the blue and the 2 left digits the green.

Parameters:

hex_val (str) – hexadecimal value.

Returns:

a list containing R, G, B values.

Return type:

a list of integer

>>> from gamebeye.gbcamcolors.color_helpers import hex_to_rgb
>>> hex_to_rgb('#000000')
[0, 0, 0]
>>> hex_to_rgb('#FF0000')
[255, 0, 0]
>>> hex_to_rgb('#00FF00')
[0, 255, 0]
>>> hex_to_rgb('#0000FF')
[0, 0, 255]
>>> hex_to_rgb('#FFFFFF')
[255, 255, 255]
>>> hex_to_rgb('#F000000')
[255, 255, 255]
gamebeye.gbcamcolors.color_helpers.is_clamped(val: int) bool

Check if val is clamped between 0 and 255.

If val is out of boundaries, returns False. True otherwise.

Parameters:

val (int) – the value to be checked

Returns:

the comparison result

Return type:

bool

>>> from gamebeye.gbcamcolors.color_helpers import is_clamped
>>> is_clamped(-125)
False
>>> is_clamped(0)
True
>>> is_clamped(125)
True
>>> is_clamped(255)
True
>>> is_clamped(512)
False
gamebeye.gbcamcolors.color_helpers.is_clamped_hex(hex_val: str) bool

Ensure that val is between ‘#000000’ and ‘#FFFFFF’.

If val is out of boundaries, returns False. True otherwise.

Parameters:

hex_val (str) – an hexadecimal value

Returns:

the comparison result

Return type:

bool

>>> from gamebeye.gbcamcolors.color_helpers import is_clamped_hex
>>> is_clamped_hex('#000000')
True
>>> is_clamped_hex('#FFFFFF')
True
>>> is_clamped_hex('#00FF00')
True
>>> is_clamped_hex('#F000000')
False
gamebeye.gbcamcolors.color_helpers.is_clamped_rgb(rgb_val: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) bool

Check if the RGB color values are clamped between 0 and 255.

If val is out of boundaries, returns False. True otherwise.

Parameters:

rgb_val (List[int]) – 3-channels list for R, G, B

Raises:

ValueError – rgb_val argument must be a 3 values list

Returns:

the comparison result

Return type:

bool

>>> from gamebeye.gbcamcolors.color_helpers import is_clamped_rgb
>>> is_clamped_rgb([0, 0, 0])
True
>>> is_clamped_rgb([255, 255, 255])
True
>>> is_clamped_rgb([512, 0, 0])
False
>>> is_clamped_rgb([255, 255, 255, 0])
Traceback (most recent call last):
    ...
ValueError: rgb_val argument must be a 3 values list
gamebeye.gbcamcolors.color_helpers.rgb_to_hex(rgb_val: _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | bool | int | float | complex | str | bytes | _NestedSequence[bool | int | float | complex | str | bytes]) str

Convert a (R, G, B) array to hexadecimal integer.

All values are clamped between 0 and 255.

Parameters:

rgb_val (list) – (R, G, B) list to convert

Raises:

ValueError – rgb_val argument must be a 3 values list

Returns:

an hexadecimal value

Return type:

str

>>> from gamebeye.gbcamcolors.color_helpers import rgb_to_hex
>>> rgb_to_hex([0, 0, 0])
'#000000'
>>> rgb_to_hex([0, 0, 255])
'#0000FF'
>>> rgb_to_hex([255, 0, 0])
'#FF0000'
>>> rgb_to_hex([512, 128, 0])
'#FF8000'
>>> rgb_to_hex([0, 0, 0, 0])
Traceback (most recent call last):
    ...
ValueError: rgb_val argument must be a 3 values list
gamebeye.gbcamcolors.color_helpers.rgb_to_lab(rgb_val)

Convert a (R, G, B) array to a (L, a, b) array.

Parameters:

rgb_val (list) – (R, G, B) list to convert

Returns:

a list containing L, a, b values.

Return type:

np.array

>>> from gamebeye.gbcamcolors.color_helpers import rgb_to_lab
>>> rgb_to_lab([25, 50, 75])
array([ 20.0262693 ,  -0.6623394 , -18.32821659])
gamebeye.gbcamcolors.color_helpers.scaled_array(array: list, src_range: list[int], dest_range: list[int]) ndarray

Scale an array from a source range to a destination range.

Parameters:

array (list) – array to scale

Returns:

a scaled array

Return type:

np.ndarray

>>> from gamebeye.gbcamcolors.color_helpers import scaled_array
>>> scaled_array([0, 0, 255], [0, 255], [0, 1])
np.array([0., 0., 1.])
>>> scaled_array([512, 128, 0], [0, 255], [0, 1])
array([2.00784314, 0.50196078, 0. ])