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 );
}
Methods
The following methods are available on the Theme object:
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.MethodAllows 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.SetBtnTextColorDefine the standard text color of
buttons and
toggles.
thm.SetButtonOptionsDefine standard options of
buttons and
toggles.
thm.SetButtonStyleDefine standard style of
buttons and
toggles.
thm.SetCheckBoxOptionsDefine standard options of
check boxes.
thm.SetDialogBtnColorDefine standard button colors of
dialogs.
thm.SetDialogBtnTxtColorDefine standard button text colors of
dialogs.
thm.SetDialogColorDefine standard dialog background colors of
dialogs.
thm.SetDimBehindEn/Disables standard dimming of
dialogs.
thm.SetProgressBackColorDefine standard background progress color of
progress indicators.
thm.SetProgressBarOptionsDefine standard options of
progress bars.
thm.SetProgressTextColorDefine standard text color of
progress indicators.
thm.SetTextColor
Define standard text color of controls.
thm.SetTextEditOptionsDefine standard options of
text edits.
thm.SetTitleColorDefine standard title text color of
dialogs.
thm.SetTitleDividerColorDefine standard title divider color of
dialogs.
thm.SetTitleHeightDefine standard height of
dialogs.