Back

CreateTheme

Hello World
Content:
- Methods

Returns a Theme object.

thm = app.CreateTheme( baseTheme ) → app object: Theme

Note: This function is a premium feature. Please consider subscribing to Premium to use this feature and support DroidScript in its further development.

Example - Hackers Theme

function OnStart()
{
    SetHackerTheme();

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

    skb = app.CreateSeekBar( .8 );
    skb.SetValue( 50 );
    lay.AddChild( skb );

    spn = app.CreateSpinner( "FRED,BILL,MARK", .4, .1 );
    spn.SetMargins( 0, .05, 0, .05 );
    lay.AddChild( spn );

    tgl = app.CreateToggle( "Toggle", .3, .1 );
    lay.AddChild( tgl );

    edt = app.CreateTextEdit( "Hello World", .8 );
    edt.SetMargins( 0, .05, 0, .05 );
    lay.AddChild( edt );

    chk = app.CreateCheckBox( "Check me", .3 );
    lay.AddChild( chk );

    app.AddLayout( lay );

    app.Alert( "My Text", "Custom theme" );
}

function SetHackerTheme()
{
    var theme = app.CreateTheme("dark");
    theme.SetBtnTextColor( "green" );
    theme.SetTitleColor( "green" );
    theme.SetDialogBtnTxtColor( "green" );
    theme.SetTextColor( "green" );
    theme.AdjustColor( -76 );
    app.SetTheme( theme );

}
    Copy     Copy All       Run      

Methods

The following methods are available on the Theme object:

GetType() → string: “Theme”
Method( name, types, p1, p2, p3, p4 ) → all types
boolean
string
number: fraction (0..1)
number: pixel
number: -180..180
number: -100..100
number: 0..100
string:
  hexadecimal: “#rrggbb”, “#aarrggbb”
  colourName: “red”, “green”, ...
string: path to file or folder ( “/absolute/...” or “relative/...” )
string: “Dark” or “Light”
string: “repeat”
string: comma “,” separated: “FontAwesome”, “Html”, “Monospace”, “SingleLine”, “Custom”, “NoPad”, “FillX/Y”, “Normal” or “Aluminium” or “Gray” or “Lego”
string: comma “,” separated: “FillX/Y”
string: comma “,” separated: “Light”
string: “underline”
string: comma “,” separated: “px” or “dip” or “sp” or “mm” or “pt” or “pl” or “ps”
list: boolean,char,byte,short,int,long,float,double,String,CharSequence,...
thm.AdjustColor
Adjust the visual color effect of the control by setting the Hue (by angle in degrees in a color circle), the saturation, brightness and contrast of the control.
thm.GetType
Returns the control class name.
thm.Method
Allows access to other functions defined on the object in Java via reflection.

Note: This function is a premium feature. Please consider subscribing to Premium to use this feature and support DroidScript in its further development.
thm.SetBackColor
Changes the background color of the control.
thm.SetBackground
Changes the background to an image which can be repeated using the repeat option.
An image which is often used with that option is '/res/drawable/pattern_carbon' - try it out!
thm.SetBtnTextColor
Define the standard text color of buttons and toggles.
thm.SetButtonOptions
Define standard options of buttons and toggles.
thm.SetButtonStyle
Define standard style of buttons and toggles.
thm.SetCheckBoxOptions
Define standard options of check boxes.
thm.SetDialogBtnColor
Define standard button colors of dialogs.
thm.SetDialogBtnTxtColor
Define standard button text colors of dialogs.
thm.SetDialogColor
Define standard dialog background colors of dialogs.
thm.SetDimBehind
En/Disables standard dimming of dialogs.
thm.SetProgressBackColor
Define standard background progress color of progress indicators.
thm.SetProgressBarOptions
Define standard options of progress bars.
thm.SetProgressTextColor
Define standard text color of progress indicators.
thm.SetTextColor
Define standard text color of controls.
thm.SetTextEditOptions
Define standard options of text edits.
thm.SetTitleColor
Define standard title text color of dialogs.
thm.SetTitleDividerColor
Define standard title divider color of dialogs.
thm.SetTitleHeight
Define standard height of dialogs.