With only a small number of "COLOR_*" colors defined, and 64 colors on the vivoactive, I wanted to see ALL the colors looked like on the vivoactive. So here are the two source files I used. The second contains the smarts as to size of increment, and timer speed, etc. It's an app, and when it's started, it cycles trough all the colors each filling the top half of the screen, and shows you the hex version of the color, so you can use it in your code. The "start" button is used to start/stop the changes, so you can write down a color you like.
forgive any typos in words or styles!
ColorPaleteApp.mc
----------------------
using Toybox.Application as App;
using Toybox.WatchUi as Ui;
class ColorPaleteApp extends App.AppBase {
//! onStart() is called on application start up
function onStart() {
}
//! onStop() is called when your application is exiting
function onStop() {
}
//! Return the initial view of your application here
function getInitialView() {
return [ new ColorPaleteView(), new ColorPaleteDelegate() ];
}
}
ColorPaleteView.mc
-----------------------
using Toybox.WatchUi as Ui;
using Toybox.Graphics as Gfx;
using Toybox.System as Sys;
var running=true;
class ColorPaleteView extends Ui.View {
var timer;
var cColor=0;
var cColorNum=0;
//you can set colors start here
var r=0;
var g=0;
var b=0;
function initialize()
{
timer = new Timer.Timer();
//set timer value here
timer.start( method(:onTimer), 750, true );
Sys.println((Gfx.COLOR_YELLOW).format("%06X"));
}
function onTimer()
{
//change to the next color.
if(running)
{
b=b+3;
if(b>15)
{
b=0;
g=g+3;
if(g>15)
{
g=0;
r=r+3;
if(r>15)
{
r=0;
g=0;
b=0;
}
}
}
}
Ui.requestUpdate();
}
//! Load your resources here
function onLayout(dc) {
//setLayout(Rez.Layouts.MainLayout(dc));
}
//! Restore the state of the app and prepare the view to be shown
function onShow() {
}
//! Update the view
function onUpdate(dc) {
dc.setColor(Gfx.COLOR_BLACK, Gfx.COLOR_BLACK);
dc.clear();
dc.setColor(Gfx.COLOR_WHITE, Gfx.COLOR_TRANSPARENT);
cColor="0x"+r.format("%X")+r.format("%X")+g.format("%X")+g.format("%X")+b.format("%X")+b.format("%X");
cColorNum=(r*16+r)*(256*256)+(g*16+g)*256+(b*16+b);
dc.drawText( dc.getWidth() / 2, dc.getHeight()-65, Gfx.FONT_SMALL,"Start/enter to pause/continue!",Gfx.TEXT_JUSTIFY_CENTER);
dc.drawText( dc.getWidth() / 2, dc.getHeight()-40, Gfx.FONT_MEDIUM,"Color=0x"+cColorNum.format("%06X"),Gfx.TEXT_JUSTIFY_CENTER);
dc.setColor(Gfx.COLOR_WHITE,Gfx.COLOR_TRANSPARENT);
dc.drawRectangle(5, 5, dc.getWidth()-10, dc.getHeight()/2);
dc.setColor(cColorNum,Gfx.COLOR_TRANSPARENT);
dc.fillRectangle(6, 6, dc.getWidth()-12, dc.getHeight()/2-2);
}
//! Called when this View is removed from the screen. Save the
//! state of your app here.
function onHide() {
}
}
class ColorPaleteDelegate extends Ui.BehaviorDelegate {
function onMenuItem(item) {
}
function onKey(evt) {
if(evt.getKey()==Ui.KEY_ENTER)
{
running=!running;
return true;
}
else
{
return false;
}
}
}