Last active
November 12, 2020 10:55
-
-
Save behnammodi/dc1db42fff9c263060f6c4cd7d205d56 to your computer and use it in GitHub Desktop.
Revisions
-
behnammodi revised this gist
Nov 12, 2020 . 1 changed file with 1 addition and 63 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,63 +1 @@ // goto https://github.com/behnammodi/ios-widget-global-calendar -
behnammodi revised this gist
Nov 12, 2020 . No changes.There are no files selected for viewing
-
behnammodi revised this gist
Nov 12, 2020 . No changes.There are no files selected for viewing
-
behnammodi revised this gist
Nov 12, 2020 . No changes.There are no files selected for viewing
-
behnammodi renamed this gist
Nov 12, 2020 . 1 changed file with 21 additions and 23 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +1,5 @@ const LOCALE = args.widgetParameter || "fa-ir"; const COLOR_BACKGROUND = Color.dynamic( new Color("ffffff", 1), new Color("222222", 1) @@ -10,56 +12,52 @@ const COLOR_BODY = Color.dynamic( new Color("666666", 1), new Color("cccccc", 1) ); const TYPOGRAPHY_TITLE = Font.boldSystemFont(40); const TYPOGRAPHY_HEADER = Font.systemFont(30); const TYPOGRAPHY_BODY = Font.systemFont(15); function renderYearAndMonth(widget, { year, month }) { const text = widget.addText(`${month} ${year}`); text.centerAlignText(); text.textColor = COLOR_BODY; text.font = TYPOGRAPHY_BODY; } function renderDay(widget, { day }) { const text = widget.addText("🗓" + day); text.centerAlignText(); text.textColor = COLOR_TEXT; text.font = TYPOGRAPHY_TITLE; } function renderWeekday(widget, { weekday }) { const text = widget.addText(weekday); text.centerAlignText(); text.textColor = COLOR_TEXT; text.font = TYPOGRAPHY_HEADER; } function render() { const date = new Date(); const year = date.toLocaleDateString(LOCALE, { year: "numeric" }); const month = date.toLocaleDateString(LOCALE, { month: "long" }); const day = date.toLocaleDateString(LOCALE, { day: "numeric" }); const weekday = date.toLocaleDateString(LOCALE, { weekday: "long" }); const widget = new ListWidget(); widget.backgroundColor = COLOR_BACKGROUND; renderDay(widget, { day }); renderWeekday(widget, { weekday }); renderYearAndMonth(widget, { year, month }); return widget; } Script.name("Global Calendar"); Script.setWidget(render()); Script.complete(); -
behnammodi revised this gist
Nov 11, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,7 +30,7 @@ const getMonthName = (month) => }[month]); function renderYearAndMonth(widget, { year, month }) { const text = widget.addText(`${getMonthName(month)} 🗓 ${year}`); text.centerAlignText(); text.textColor = COLOR_BODY; text.font = TYPOGRAPHY_BODY; -
behnammodi revised this gist
Nov 11, 2020 . No changes.There are no files selected for viewing
-
behnammodi revised this gist
Nov 11, 2020 . No changes.There are no files selected for viewing
-
behnammodi renamed this gist
Nov 11, 2020 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
behnammodi created this gist
Nov 11, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,65 @@ const COLOR_BACKGROUND = Color.dynamic( new Color("ffffff", 1), new Color("222222", 1) ); const COLOR_TEXT = Color.dynamic( new Color("222222", 1), new Color("ffffff", 1) ); const COLOR_BODY = Color.dynamic( new Color("666666", 1), new Color("cccccc", 1) ); const TYPOGRAPHY_TITLE = Font.boldSystemFont(60); const TYPOGRAPHY_BODY = Font.boldSystemFont(20); const getMonthName = (month) => ({ "۱": "فروردین", "۲": "اردیبهشت", "۳": "خرداد", "۴": "تیر", "۵": "مرداد", "۶": "شهریور", "۷": "مهر", "۸": "آبان", "۹": "آذر", "۱۰": "دی", "۱۱": "بهمن", "۱۲": "اسفند", }[month]); function renderYearAndMonth(widget, { year, month }) { const text = widget.addText(`${getMonthName(month)} ● ${year}`); text.centerAlignText(); text.textColor = COLOR_BODY; text.font = TYPOGRAPHY_BODY; } function renderDay(widget, { day }) { const text = widget.addText(day); text.centerAlignText(); text.textColor = COLOR_TEXT; text.font = TYPOGRAPHY_TITLE; } function render() { const date = new Date(); const [year, month, day] = date.toLocaleDateString("fa-ir").split("/"); const widget = new ListWidget(); widget.setPadding(8, 8, 8, 8); widget.backgroundColor = COLOR_BACKGROUND; renderDay(widget, { day }); renderYearAndMonth(widget, { year, month }); return widget; } Script.setWidget(render()); Script.complete(); Script.name("تقویم شمسی");