Skip to content

Instantly share code, notes, and snippets.

@fischgeek
Created October 20, 2021 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fischgeek/a10a3acac5abdca9fe81cf7ff359b329 to your computer and use it in GitHub Desktop.
Save fischgeek/a10a3acac5abdca9fe81cf7ff359b329 to your computer and use it in GitHub Desktop.
Scriptable Utils
function baseGrad() {
let g = new LinearGradient()
g.locations = [0, 1]
return g
}
function gradBaseBlackTop(clr) {
let g = baseGrad()
g.colors = [
new Color("141414"),
new Color(clr)
]
return g
}
function gradBaseBlackBottom(clr) {
let g = baseGrad()
g.colors = [
new Color(clr),
new Color("141414")
]
return g
}
class Grads {
blackToBlue() { return gradBaseBlackTop("13233F") }
blueToBlack() { return gradBaseBlackBottom("13233F") }
}
module.exports.Grads = () => {
return new Grads()
}
class DT {
gethr() {
let dw = new Date()
let d = dw.getDate().toString()
let df = new DateFormatter()
df.dateFormat = "h"
return df.string(dw)
}
getAbbrDow() {
let dw = new Date()
let d = dw.getDate().toString()
let df = new DateFormatter()
df.dateFormat = "E"
return df.string(dw)
}
}
module.exports.DT = () => {
return new DT()
}
class Fonts {
mono(s) {
// return new Font("Courier", s)
return new Font("DB LCD Temp", s)
}
clock(s) {
return new Font("DB LCD Temp", s)
}
}
module.exports.Fonts = () => {
return new Fonts()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment