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 );
}
from native import app
def 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" )
def SetHackerTheme():
theme = app.CreateTheme("dark")
theme.SetBtnTextColor( "green" )
theme.SetTitleColor( "green" )
theme.SetDialogBtnTxtColor( "green" )
theme.SetTextColor( "green" )
theme.AdjustColor( -76 )
app.SetTheme( theme )
Properties
The following properties are available on the Theme object:
Methods
The following methods are available on the Theme object:
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” or “Default”
String: comma “,” separated: “boolean”, “char”, “byte”, “short”, “int”, “long”, “float”, “double”, “String”, “CharSequence”, “...”
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:
args }
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.data
An object for saving individual extra properties.
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.SetButtonPadding
Define distances that elements within the control are to maintain from the control borders.
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 background colors of
dialogs.
thm.SetDialogCornerRadiusDefine standard corder radius of
dialogs.
thm.SetDimBehindEn/Disables standard dimming of
dialogs.
thm.SetHighlightColor
Define standard highlight colors.
thm.SetListDividerColorDefine standard divider colors of
lists.
thm.SetProgressBackColorDefine standard background progress color of
progress indicators.
thm.SetProgressBarOptionsDefine standard options of
progress bars.
thm.SetProgressOptionsDefine standard options of
progress indicators.
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.SetTitleDividerHeightDefine standard title divider height of
dialogs.
thm.SetTitleHeightDefine standard height of
dialogs.
thm.SetTitleTextSizeDefine standard title text size of
dialogs.