Skip to content

Instantly share code, notes, and snippets.

async function drawArc(
on,
percent = 50,
percent2 = -1
) {
const canvSize = 200;
const canvas = new DrawContext();
canvas.opaque = false;
const canvWidth = 18; // circle thickness
const canvRadius = 80; // circle radius
@niklasvieth
niklasvieth / polestar-lockscreen-widget.js
Last active January 18, 2024 09:53
An iOS lockscreen widget to display the current state of charge (SoC) of your Polestar 2. See https://github.com/niklasvieth/polestar-ios-lockscreen-widget for details.
// icon-color: green; icon-glyph: battery-half;
/**
* This widget has been developed by Niklas Vieth.
* Installation and configuration details can be found at https://github.com/niklasvieth/polestar-ios-lockscreen-widget
*/
// Config
const POLESTAR_EMAIL = "EMAIL_ADDRESS";
const POLESTAR_PASSWORD = "PASSWORD";
@niklasvieth
niklasvieth / polestar-medium-widget.js
Last active April 26, 2024 06:53
An iOS medium widget to display the current state of charge (SoC) of your Polestar 2. See https://github.com/niklasvieth/polestar-ios-medium-widget for details.
// icon-color: green; icon-glyph: battery-half;
/**
* This widget has been developed by Niklas Vieth.
* Installation and configuration details can be found at https://github.com/niklasvieth/polestar-ios-medium-widget
*/
// Mandatory Config
const POLESTAR_EMAIL = "EMAIL";
const POLESTAR_PASSWORD = "PASSWORD";
@niklasvieth
niklasvieth / polestar-small-widget.js
Last active April 26, 2024 06:58
An iOS small widget to display the current state of charge (SoC) of your Polestar 2. See https://github.com/niklasvieth/polestar-ios-small-widget for details.
// icon-color: green; icon-glyph: battery-half;
/**
* This widget has been developed by Niklas Vieth.
* Installation and configuration details can be found at https://github.com/niklasvieth/polestar-ios-small-widget
*/
// Mandatory Config
const POLESTAR_EMAIL = "EMAIL";
const POLESTAR_PASSWORD = "PASSWORD";