I've updated the gist with an instruction on getting it with a transparent background, but for the labels I'll have play around with the text placement
For sure! May I ask you a question? How can I adding padding to space out the emoji and the numerics? Thanks!! And again, great widget been looking for something like this for ages!
If you're using the version with "labels", you should have these lines:
const canvTextRect = new Rect(
0,
100 - canvTextSize / 2,
canvSize,
canvTextSize
);
const canvLabelRect = new Rect(
0,
(100 - canvTextSize / 2) - 35,
canvSize,
canvTextSize + 25
);```
Change the 100 in the `canvLabelRect` section (or adjust the 35) to move the emoji/icons up/down
If you increase it (100 -> 150), it moves the emoji/icon down, and decreasing it (100 -> 50) moves the emoji/icon up.
You can probably delete the "35"
p.s. If you want move the actual info text down/up, change the "100" in the `canvTextRect ` section too
For sure. Not sure how to github it but here u go:
// Variables used by Scriptable. // These must be at the very top of the file. Do not edit. // icon-color: purple; icon-glyph: magic; let today = new Date(); let dayNumber = Math.ceil((today - new Date(today.getFullYear(),0,1)) / 86400000); let thisDayDate = today.getDate() let thisMonth = today.getMonth() let thisYear = today.getFullYear() let daysYear = (leapYear(today.getFullYear())) ? 366 : 365; let daysThisMonth = daysInMonth(thisMonth+1, thisYear) const dateFormatter = new DateFormatter() dateFormatter.dateFormat = "MMM"
const canvSize = 200; const canvTextSize = 35; const canvas = new DrawContext(); const battCircleRemainColor = new Color('#799351'); //Battery remaining color const battCircleDepletedColor = new Color('#d54062'); //Battery depleted color const battCircleBGColor = new Color('#fff'); //Widget background color const battCircleTextColor = new Color('#f39'); //Widget text color (use same color as above to hide text)
const remainColor = new Color('#dddddd') const monthCircleColor = new Color('#ffa36c') const dayCircleColor = new Color('#ebdc87') const dayNCircleColor = new Color('#318fb5')
const canvWidth = 30; //Battery circle thickness const canvRadius = 85; //Battery circle radius
// Month here is 1-indexed (January is 1, February is 2, etc). This is // because we're using 0 as the day so that it returns the last day // of the last month, so you have to add 1 to the month number // so it returns the correct amount of days function daysInMonth (month, year) { return new Date(year, month, 0).getDate(); }
3
u/tempsquared Oct 22 '20 edited Oct 22 '20
https://gist.github.com/brainno722/77e9d3e2c4e45447182e226ac6153bd3
Inspired by https://www.reddit.com/r/Scriptable/comments/jeqlk1/finally_got_around_to_finishing_my_first_widget/
and https://www.reddit.com/r/Scriptable/comments/jb7x56/is_there_a_way_to_make_a_circle_chart_like_this/g8v0jdn?utm_source=share&utm_medium=web2x&context=3
I cannot decide whether to show all text, all numbers, or hybrid
Edit
Updated gist with a README and a script with a method for a transparent background
2
u/tempsquared Oct 22 '20
Another take, but on a small widget Small circles
2
u/quintusmanilus Oct 24 '20
Love it, thanks! Modified it sliiiiiiiiiightly https://imgur.com/gallery/ER7qK67
1
u/L4Hacks Oct 27 '20
Is it possible to add gradient to the arc?