excaliburjs / Excalibur

🎮 Your friendly TypeScript 2D game engine for the web 🗡️

Home Page:https://excaliburjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Wrong hex color values

mcavazotti opened this issue · comments

Steps to Reproduce

  1. Create a Color object instance (for example green #00ff00)
  2. Apply any of the following methods: saturate, desaturate, darken, lighten
  3. Call toHex
        const color = Color.Green;
        console.log('Original color:\t',color.toHex());
        console.log('saturate:\t', color.clone().saturate().toHex());
        console.log('desaturate:\t', color.clone().desaturate().toHex());
        console.log('darken:\t\t', color.clone().darken().toHex());
        console.log('lighten:\t', color.clone().lighten().toHex());

Expected Result

It should print a valid hexadecimal representation of a color;

Actual Result

Original color:	 #00ff00
saturate:	 #-c.c0000000000310b.c-c.c00000000003
desaturate:	 #c.c00000000003f2.4c.c00000000003
darken:		 #00e5.800
lighten:	 #19.800000000006ff19.800000000006

Environment

  • browsers and versions: Chrome
  • operating system: Windows
  • Excalibur versions: 0.29.1

Current Workaround

Monkey patching?

I can create a PR to fix it

@mcavazotti Good find! This is definitely a bug, please do proceed with a PR!