/*
 * gc_clor_theme.h
 *
 */

#ifndef GC_COLOR_THEME_H_
#define GC_COLOR_THEME_H_

#include <stdint.h>

namespace gc_color_theme
{
	enum gc_color_index_t
	{
		gc_color_transparent=0,
		gc_color_black=1,

		gc_color_dbg_start=26,
		gc_color_green=gc_color_dbg_start,
		gc_color_red,
		gc_color_yellow,
		gc_color_gray,
		gc_color_blue,
		gc_color_dbg,  //cyan

		gc_color_first_unused
	};

	enum sc_sw_color_index_t
	{	//SC color 0..255 re-mapped to sc_color_base..255 for SW layer overlay
		//  0..255 -> 32..255 -> 7/8*255 = 32+(SC_COLOR * 7)/8 = 32+(SC_COLOR*7)>>3  no division required
		sc_color_base=32,   //shall be >=gc_color_first_unused
		sc_color_shift=3,
		sc_color_factor=7 /*=int((256<<shift)/(256-base)) - pre-calculated to be sure to not have rounding problems*/
	};

#if 0
	static inline uint8_t sc_color_index_convert(uint8_t v)
	{
		return (v>>1)+128;
	}
#else
	static inline unsigned int sc_color_index_convert(unsigned int v)
	{
		unsigned int x=v;
		x*=sc_color_factor;
		x>>=sc_color_shift;
		x+=sc_color_base;
		return x;
	}
#endif
}


#endif /* GC_COLOR_THEME_H_ */
