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
Number
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 ( “/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: “px” or “sp” or “dip” or “mm” or “pt”
String: comma “,” separated: “FillX/Y”
String: “Light”
String: comma “,” separated: “NoDim”, “NonModal”, “Solid”
String: “underline”
String: comma “,” separated: “px” or “dip” or “sp” or “mm” or “pt” or “pl” or “ps”
Object: { COMMAND }
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.Batch
Batch method calls to be able to set all object's properties at once.
Note that you need to specify each parameter (use “” or null to leave some out)
Inherited methods can be called by appending an underscore to the function name (ie. txt.Batch({ SetBackColor_: [“red”] })
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.SetButtonPadding
Define distances that elements within the control are to maintain from the control borders.
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 background colors of dialogs.
thm.SetDialogCornerRadius
Define standard corder radius of dialogs.
thm.SetDimBehind
En/Disables standard dimming of dialogs.
thm.SetHighlightColor
Define standard highlight colors.
thm.SetListDividerColor
Define standard divider colors of lists.
thm.SetProgressBackColor
Define standard background progress color of progress indicators.
thm.SetProgressBarOptions
Define standard options of progress bars.
thm.SetProgressOptions
Define standard options of progress indicators.
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.SetTitleDividerHeight
Define standard title divider height of dialogs.
thm.SetTitleHeight
Define standard height of dialogs.
thm.SetTitleTextSize
Define standard title text size of dialogs.