Back

Color

C O L O R

Todo: Documentation for Color

In order to use Color, you must first load the plugin at the top of your script using the LoadPlugin method like this:

 app.LoadPlugin( "Support" );

Colors:


Masks:

For red text: color.RED

For dark red color.RED_DARK_1

Examples:

color.GetRandomColor( mask );

Example - Get Random Color

app.LoadPlugin( "Support" );

function OnStart()
{
  lay = app.CreateLayout( "Linear", "VCenter,FillXY" );

  btn = app.CreateButton( "Change Color" );
  btn.SetOnTouch( btn_OnTouch );
  lay.AddChild( btn );

  app.AddLayout( lay );
}

function btn_OnTouch()
{
  app.SetBackColor( color.GetRandomColor() );
}

  Copy   Copy All    Run   
mask: white or black

Example - Get Random Color For White Text

app.LoadPlugin( "Support" );

function OnStart()
{
  lay = app.CreateLayout( "Linear", "VCenter,FillXY" );

  btn = app.CreateButton( "Change Color" );
  btn.SetBackColor( color.BLUE );
  btn.SetTextColor( color.WHITE );
  btn.SetOnTouch( btn_OnTouch );
  lay.AddChild( btn );

  app.AddLayout( lay );
}

function btn_OnTouch()
{
  app.SetBackColor( color.GetRandomColor( "white" ) ); }
  Copy   Copy All    Run   
color.ShowColorPicker( title, callback, options );
options: NoTitle - NoDim - NoCancel

Example - Color Picker

app.LoadPlugin( "Support" );

function OnStart()
{
  lay = app.CreateLayout( "Linear", "VCenter,FillXY" );

  btn = app.CreateButton( "Change Color" );
  btn.SetOnTouch( btn_OnTouch );
  lay.AddChild( btn );

  app.AddLayout( lay );
}

function btn_OnTouch()
{
  color.ShowColorPicker( "Colors", OnSelectColor );
}

function OnSelectColor( hexcode, name )
{
  app.Alert( hexcode, name );
  app.SetBackColor( hexcode );
}
  Copy   Copy All    Run   

Helper plugin for Support

thanks for using

Version: 1.0