Reference

DP - date parser

DP: date parser (Creates a date or a time span from text)

Syntax

dp(date, [pattern])

Arguments

  • date: Date to be used. The Date can be returned by some other function or you can use text. For text dates you can both set it statically using the format '1955y11M12d22h04m00s' to express year 1955, month 11, day 12 at 22:04:00 (all fields are optional), or use 'a/r' (add/remove) operators, so, for example 'a12m3s' will add 12 minutes and 3 secs to current date.
  • pattern: A standard Java Date Time format pattern to parse the date

Examples

FormulaDescription
$dp(0h0m0s)$Today's midnight
$dp(01M01d0h0m0sa1y)$New year's eve
$dp("2010-07-30T16:03:25Z", auto)$Parse date string using ISO / auto format
$dp(05-07-2010, dd-MM-yyyy)$Parse date string using custom date format

Dynamic colors

System colors #

All Kustom apps can extract color palette from different sources, such as:

  • Wallpaper through the System Info function: $si(wpcolor1)
  • A given image using the Bitmap Palette function: $bp(img, 1)
  • System palette either based on wallpaper or via Material You color, see below

Material You #

On devices supporting dynamic themes Kustom will try to extract the palette definition from the System. Following colors will then be available as variables through the System Info:

...

FD - fitness data

FD: fitness data (activities data, total steps, calories…)

Syntax

fd(type, [start], [end], [activity/segment], [segment])

Arguments

  • type: Info type, see examples
  • start: Date to be used. The Date can be returned by some other function or you can use text. For text dates you can both set it statically using the format '1955y11M12d22h04m00s' to express year 1955, month 11, day 12 at 22:04:00 (all fields are optional), or use 'a/r' (add/remove) operators, so, for example 'a12m3s' will add 12 minutes and 3 secs to current date.
  • end: Date to be used. The Date can be returned by some other function or you can use text. For text dates you can both set it statically using the format '1955y11M12d22h04m00s' to express year 1955, month 11, day 12 at 22:04:00 (all fields are optional), or use 'a/r' (add/remove) operators, so, for example 'a12m3s' will add 12 minutes and 3 secs to current date.
  • activity/segment: Activity type, eg running, walking and so on (regexp are accepted), optionally you can put segment here
  • segment: Segment when filtering by activity (0 is the first segment the range, -1 the last)

Examples

FormulaDescription
$fd(steps)$Steps today
$fd(cals)$Active calories today
$fd(calsr, a0d, a0d)$Inactive calories today
$fd(dista)$$fd(distu)$Distance today (in local unit)
$fd(dist)$Distance today (in meters)
$tf(fd(time))$Active time today
$fd(steps, r1d, r1d)$Steps yesterday
$fd(count)$Number of activities today
Last activity: $fd(activity, r1d, r0d, -1)$ for $tf(fd(time, r1d, r0d, -1))$ $df("hh:mma", fd(start, r1d, r0d, -1))$Last activity in the last 2 days
$fd(steps, 1w) / mu(abs, (tf(1w, D) + 1))$Average steps per day this week
Active for $tf(fd(time), H)$ hours and $tf(fd(time), m)$ minutesActive time today in hours and minutes
HR max:$fd(hrmax)$, min: $fd(hrmin)$, avg: $fd(hravg)$Max, min and average HR today
HR:$fd(hrmax, r60s, r0s)$Current HR if being recorded
Sleep:$tf(fd(sleept, 22hr1d, r0h))$Sleep time last night
Elevation:$fd(elema)$$fd(elemu)$Elevation gained today in local unit
Floors:$fd(floors)$Floors climbed today

FL - for loops

FL: for loops (execute a statement multiple times)

Syntax

fl(init, stop, increment, loop, [sep])

Arguments

  • init: First value of the i variable
  • stop: Condition valuue to meet in order to stop, eg 10
  • increment: Increment formula, eg i + 1
  • loop: Repeat formula or value, i will be replaced with the var
  • sep: Optional separator between elements

Examples

FormulaDescription
$fl(5, 20, "i + 1", "i", " ")$Write numbers from 5 to 20 spaced
$fl(1, 7, "i + 1", "df(EEE, a + i + d)")$Write short name of next 7 days
$fl(1, tu(seq, 1, 1, 10), "i + 1", "#")$Shows from 1 to 10 # symbols, adding one every minute

Flows

Flows #

From Kustom 3.70 all layers have a new tab called “flows”, what are flows? A flow is a quick way to get one or more tasks done with your apps. The Flows tab app lets you create your own automations with multiple steps. For example, download some data from a site then parse the content and download an image from it, or generate some text every hour or trigger an animation through a global with some delay after a touch.

...

Global Variables

How to use Globals #

If you open the Advanced Editor you will notice on the first “root” container a tab called “globals”, that section will allow you to add / remove and change Global variables which are just settings that can be applied to multiple modules at once. So, how to use them?

So let’s say you have a preset with a lot of text items around and you decide that you want to change the font of all of these very quickly from a single setting point, so, in this case, you use a Global, so you:

...

GV - global variables

GV: global variables (get value of a global variable)

Syntax

gv(var, [default], [index])

Arguments

  • var: The key of the global to retrieve
  • default: An optional default to return if global is not found
  • index: An optional index to return a specific item in list globals

Examples

FormulaDescription
$gv(fgcolor, #FF0000)$Will return the value of var fgcolor or red color if not found

IF - if conditions

IF: if conditions (if/then/else support with multiple boolean operators)

Syntax

if(condition, then, [else])

Arguments

  • condition: A condition can use any comparison like = (equals), > (greater), >= (greater or equal), < (less), <= (less or equal) combined with boolean operators & (AND) or | (OR) and parenthesis
  • then: Text or function to use if condition is true (so if return value is not empty and not 0)
  • else: Optional text or function to be called if condition is false (so either empty or 0)

Examples

FormulaDescription
$if(df(f)>5, "Week End!", "Workday :(")$Will show Week End! during week ends or Workday :( during workdays
Battery $if(bi(level) = 100, "is fully charged", bi(level) <= 15, "is critically low", "is at " + bi(level) + "%" )$Shows status of battery writing fully charged when full, critical if below 15 or the normal level otherwise
$if(df(MMMM) ~= "a", "Has an A", NO)$Will show Has an A if this month name contains an a (regexp allowed), NO otherwise
$if(wi(code) != CLEAR, "Not Sunny")$Will show not sunny if sky is not clear, nothing otherwise

LI - location info

LI: location info (latitude, longitude, address…)

Syntax

li(type)

Arguments

  • type: Info type, see examples

Examples

FormulaDescription
$li(loc)$Current Locality (ex Hill Valley, if available)
$li(country)$Current Country Name (ex Iceland, if available)
$li(ccode)$Current Country Code (ex US, if available)
$li(addr)$Current Address (if available)
$li(admin)$Current Admin Area (ex CA, if available)
$li(neigh)$Current Neighborhood (if available, locality otherwise)
$li(postal)$Current Postal Code (if available)
$li(spd)$Current Speed in local unit (kmh/mph if available, 0 otherwise)
$li(spdm)$Current Speed in meters per second (if available, 0 otherwise)
$li(spdu)$Current Speed unit (kmh/mph)
$li(alt)$Altitude in local unit (meters/feet with GPS lock only, 0 otherwise)
$li(altm)$Altitude in meters (with GPS lock only, o otherwise)
$li(lat)$Latitude
$li(lon)$Longitude
$li(lplat)$Latitude (low precision ~50m)
$li(lplon)$Longitude (low precision ~50m)

LV - local variables

LV: local variables (get and set local variable values)

Syntax

lv()

Arguments

    Examples

    FormulaDescription
    $lv("foo", "Some Value")$Value is: $lv(foo)$Sets a simple variable and shows value using lv()
    $lv("foo", df(m))$$"Minutes are: "+#foo$Sets a simple variable and shows value using #




    Privacy Policy