Skip to content

Instantly share code, notes, and snippets.

@fischgeek
Created October 20, 2021 03:43
Show Gist options
  • Select an option

  • Save fischgeek/a10a3acac5abdca9fe81cf7ff359b329 to your computer and use it in GitHub Desktop.

Select an option

Save fischgeek/a10a3acac5abdca9fe81cf7ff359b329 to your computer and use it in GitHub Desktop.

Revisions

  1. fischgeek created this gist Oct 20, 2021.
    67 changes: 67 additions & 0 deletions utils.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,67 @@
    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()
    }