Skip to content
@cezarhere
Projects
iPhone widget

Daily Affirmations

A Lock Screen widget with a new affirmation every morning, afternoon and evening.

An iPhone Lock Screen with an afternoon affirmation under the clock: Good work takes time, and I'm giving it time.

Put a daily affirmation on your Lock Screen

A Lock Screen widget that shows a new affirmation every morning, afternoon and evening. Free, private, and set up in five minutes.

Time: About 5 minutes. No accounts, no keys.

What you'll get

  • A new affirmation on your Lock Screen three times a day
  • Morning ones to start, afternoon ones to reset, evening ones to switch off
  • Nearly 200 affirmations that cycle through the whole list before anything repeats
  • Works on the Lock Screen and as a Home Screen widget
  • Nothing to sign up for, and nothing leaves your phone

How it works

The day is split into three parts:

  1. Morning, 5:00 to 11:59
  2. Afternoon, 12:00 to 17:59
  3. Evening, 18:00 to 4:59

Each part has its own list. Every day the widget picks the next one from a shuffled order, so you see the whole list before a line comes back. After midnight still counts as the evening before.

What you'll need before we start

  • An iPhone on iOS 16 or later (Lock Screen widgets)
  • Scriptable, free on the App Store

Time: About 5 minutes.

Get the widget

On your iPhone, tap Copy. On a computer, Download saves the file instead.

DailyAffirmations.js · 13.4 KBDownload
// Variables used by Scriptable.
// These must be at the very top of the file. Do not edit.
// icon-color: deep-purple; icon-glyph: sun;

/*
  DAILY AFFIRMATIONS — Lock Screen widget for Scriptable
  ------------------------------------------------------
  • Morning   05:00–11:59
  • Afternoon 12:00–17:59
  • Evening   18:00–04:59
  A new affirmation for each period, every day. Each list is shuffled
  per year, so you cycle through a whole list before anything repeats.

  Works as: Lock Screen rectangular (best), inline, circular,
  and small/medium Home Screen widgets.

  Optional widget Parameter: "morning", "afternoon" or "evening"
  to pin one period (handy for testing).
*/

// ============ AFFIRMATIONS ============

const MORNING = [
  "Today is a fresh start, and I'm ready for it.",
  "I have everything I need to make today good.",
  "I choose progress over perfection today.",
  "My energy is focused on what matters most.",
  "I welcome this day with an open mind.",
  "I am capable of handling whatever comes.",
  "Small steps today build big results tomorrow.",
  "I wake up with purpose and clarity.",
  "I trust myself to make good decisions.",
  "Today I show up as the best version of me.",
  "I am allowed to take up space today.",
  "I start this day with gratitude.",
  "My mind is clear and my intentions are strong.",
  "I'm building something worth being proud of.",
  "I set the tone for my day.",
  "I am disciplined, focused, and driven.",
  "Opportunities find me because I'm ready.",
  "I bring calm confidence into every room.",
  "I don't need to rush. I need to begin.",
  "Today I'll do one thing my future self thanks me for.",
  "I am worthy of the good things coming my way.",
  "My potential is bigger than my doubts.",
  "I greet challenges as chances to grow.",
  "I move through today with intention.",
  "I believe in the person I'm becoming.",
  "Good things are unfolding for me.",
  "I am strong in body, clear in mind.",
  "I choose courage over comfort today.",
  "My work matters, and so do I.",
  "I have survived every hard day so far.",
  "Today, I'll be kind to myself and bold with my goals.",
  "Every morning is a new chance to rewrite the story.",
  "I focus on what I can control.",
  "I'm exactly where I need to be to start.",
  "I am creative, resourceful, and resilient.",
  "Energy flows where my attention goes.",
  "I show up, even when it's hard.",
  "I'm open to surprises and new ideas today.",
  "I am the author of today.",
  "Consistency beats intensity. I'll just keep going.",
  "I am grounded, present, and ready.",
  "I attract people who lift me up.",
  "I am proud of how far I've come.",
  "My habits are shaping a great life.",
  "Today I will learn something new.",
  "I release yesterday and embrace today.",
  "I can do hard things.",
  "I believe today will be a good day.",
  "I am enough, exactly as I am right now.",
  "My goals are within reach.",
  "I choose to see possibilities, not limits.",
  "I lead my day. It doesn't lead me.",
  "I am a magnet for good energy.",
  "Clarity comes when I take the first step.",
  "Today, done is better than perfect.",
  "I deserve success and I'm working for it.",
  "I am calm, capable, and confident.",
  "Something good is going to happen today.",
  "I honor my body by taking care of it.",
  "I'm not behind. I'm on my own path.",
  "I'll meet today with curiosity.",
  "My presence is a gift to the people around me.",
  "I have the power to create change.",
  "I am ready to grow a little today.",
];

const AFTERNOON = [
  "I'm halfway there, and I'm doing great.",
  "I can reset at any moment. This is one.",
  "I breathe in focus, I breathe out stress.",
  "My effort today is adding up.",
  "I stay steady when things get busy.",
  "It's okay to pause. Rest is productive too.",
  "I handle challenges with calm and clarity.",
  "I am making real progress, even if it's quiet.",
  "I keep my promises to myself.",
  "One task at a time. I've got this.",
  "I am patient with myself and my process.",
  "Obstacles are just part of the path.",
  "I respond instead of react.",
  "I finish what I start.",
  "My focus is sharp and my mind is clear.",
  "I choose to see the good in this moment.",
  "I'm allowed to change course.",
  "I trust the timing of my life.",
  "I'm stronger than this afternoon slump.",
  "I bring value to everything I touch.",
  "I don't have to be perfect to be effective.",
  "My mistakes are lessons, not verdicts.",
  "I let go of what I can't control.",
  "I'm proud of what I've done so far today.",
  "I stay curious, even when it's tough.",
  "I have the energy to finish strong.",
  "I speak to myself with kindness.",
  "I am resilient. I bounce back.",
  "I am focused on solutions, not problems.",
  "Pressure turns me into something stronger.",
  "I give my best, and my best is enough.",
  "I am confident in my abilities.",
  "I'm building momentum with every step.",
  "Stress doesn't own me. I own my response.",
  "Good work takes time, and I'm giving it time.",
  "I stay true to my values, even when busy.",
  "I am a problem-solver.",
  "I choose calm over chaos.",
  "I'm allowed to ask for help.",
  "Every hour is a new chance to do well.",
  "I'm moving forward, and that's what counts.",
  "I trust my instincts.",
  "My potential grows with every effort.",
  "I let small annoyances pass through me.",
  "I stay present instead of rushing ahead.",
  "What I'm doing today matters.",
  "I celebrate small wins.",
  "I am in control of my attention.",
  "I have what it takes to finish this.",
  "I release tension from my shoulders and jaw.",
  "I don't compare my middle to someone's highlight.",
  "Right now, I'm doing my best, and that's enough.",
  "I choose to stay positive and productive.",
  "My energy is renewable. I can recharge.",
  "I adapt easily to what comes my way.",
  "Hard moments pass. I remain.",
  "I bring focus to the next right thing.",
  "I'm capable of more than I think.",
  "I choose progress, not pressure.",
  "Mistakes don't define me. My comeback does.",
  "I stay hydrated, grounded, and clear.",
  "My hard work is planting seeds.",
  "I trust that I'm figuring it out.",
  "I finish today stronger than I started.",
];

const EVENING = [
  "I did enough today. I am enough.",
  "I release today with gratitude.",
  "I'm proud of how I showed up.",
  "I let go of what didn't go my way.",
  "Rest is how I prepare for tomorrow.",
  "I forgive myself for today's mistakes.",
  "My mind is quieting, my body is relaxing.",
  "I am grateful for the small good moments.",
  "Tomorrow is a fresh chance. Tonight, I rest.",
  "I deserve peace and a good night's sleep.",
  "I am safe, calm, and at ease.",
  "Today taught me something. I'm growing.",
  "I release worries I can't solve tonight.",
  "I'm thankful for the people in my life.",
  "I celebrate what I accomplished today.",
  "My worth isn't measured by my productivity.",
  "I let my thoughts slow down.",
  "I trust that things are working out.",
  "I'm at peace with where I am.",
  "I did my best with what I had.",
  "I give myself permission to rest fully.",
  "Every day, I'm becoming more of who I want to be.",
  "I let go of tension, one breath at a time.",
  "I'm grateful for my body and all it did today.",
  "I end today with kindness toward myself.",
  "What's meant for me will not pass me by.",
  "I am loved, and I am loving.",
  "Tonight, I choose calm over overthinking.",
  "I'm proud of the effort, not just the outcome.",
  "Tomorrow will take care of itself.",
  "I am more than enough, even on slow days.",
  "I rest without guilt.",
  "I carry forward the lessons, not the stress.",
  "My heart is full and my mind is clear.",
  "I welcome deep, restorative sleep.",
  "I made progress today, even if it was small.",
  "I'm grateful for this moment of stillness.",
  "I let go of comparison and embrace my journey.",
  "I choose peace before I sleep.",
  "I am growing, even when I can't see it.",
  "The day is done. I did well.",
  "I trust myself to handle tomorrow.",
  "I release the need to control everything.",
  "I'm thankful for another day of life.",
  "I close today with love and open tomorrow with hope.",
  "My mind deserves rest just as much as my body.",
  "I let today's noise fade away.",
  "I am proud of who I'm becoming.",
  "I appreciate myself for trying.",
  "Peace begins with a slow, deep breath.",
  "I'm allowed to feel content right now.",
  "Everything I need to do can wait until tomorrow.",
  "I sleep easily and wake refreshed.",
  "I choose to remember the good from today.",
  "I am gentle with myself tonight.",
  "Today's challenges made me stronger.",
  "I've done my part. I can let go now.",
  "I trust the journey, even the slow parts.",
  "I'm grateful for lessons, even hard ones.",
  "I am worthy of rest and recovery.",
  "I leave today's worries at the door.",
  "My dreams are safe with me.",
  "I end today feeling grateful and grounded.",
  "Tomorrow, I get to try again. That's a gift.",
];

// ============ PERIOD LOGIC ============

const PERIODS = {
  morning:   { label: "MORNING",   symbol: "sunrise.fill",  list: MORNING,   seed: 11 },
  afternoon: { label: "AFTERNOON", symbol: "sun.max.fill",  list: AFTERNOON, seed: 23 },
  evening:   { label: "EVENING",   symbol: "moon.stars.fill", list: EVENING, seed: 37 },
};

function currentPeriod(now) {
  const h = now.getHours();
  if (h >= 5 && h < 12) return "morning";
  if (h >= 12 && h < 18) return "afternoon";
  return "evening";
}

// Next time the period changes (05:00, 12:00, 18:00)
function nextBoundary(now) {
  const d = new Date(now);
  const h = now.getHours();
  if (h < 5) d.setHours(5, 0, 0, 0);
  else if (h < 12) d.setHours(12, 0, 0, 0);
  else if (h < 18) d.setHours(18, 0, 0, 0);
  else { d.setDate(d.getDate() + 1); d.setHours(5, 0, 0, 0); }
  return d;
}

// Day index; the early hours (00–05) still count as the previous evening
function dayIndex(now) {
  const d = new Date(now);
  if (d.getHours() < 5) d.setDate(d.getDate() - 1);
  const start = new Date(d.getFullYear(), 0, 1);
  const day = Math.floor((d - start) / 86400000);
  return { year: d.getFullYear(), day };
}

// Seeded shuffle => no repeats until the whole list has been shown
function mulberry32(a) {
  return function () {
    a |= 0; a = (a + 0x6D2B79F5) | 0;
    let t = Math.imul(a ^ (a >>> 15), 1 | a);
    t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
    return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
  };
}

function pickAffirmation(periodKey, now) {
  const p = PERIODS[periodKey];
  const { year, day } = dayIndex(now);
  const cycle = Math.floor(day / p.list.length);
  const rand = mulberry32(year * 1000 + cycle * 97 + p.seed);
  const order = p.list.map((_, i) => i);
  for (let i = order.length - 1; i > 0; i--) {
    const j = Math.floor(rand() * (i + 1));
    [order[i], order[j]] = [order[j], order[i]];
  }
  return p.list[order[day % p.list.length]];
}

// ============ WIDGET ============

const now = new Date();
const param = (args.widgetParameter || "").trim().toLowerCase();
const periodKey = PERIODS[param] ? param : currentPeriod(now);
const period = PERIODS[periodKey];
const text = pickAffirmation(periodKey, now);
const family = config.widgetFamily; // accessoryRectangular / accessoryInline / accessoryCircular / small / medium...

function addSymbol(stack, name, size) {
  const img = stack.addImage(SFSymbol.named(name).image);
  img.imageSize = new Size(size, size);
  img.tintColor = Color.white();
  return img;
}

function buildWidget() {
  const w = new ListWidget();
  w.refreshAfterDate = nextBoundary(now);

  if (family === "accessoryInline") {
    // One line only: iOS shows a single text line next to the date
    const t = w.addText(text);
    t.lineLimit = 1;
    return w;
  }

  if (family === "accessoryCircular") {
    w.addAccessoryWidgetBackground = true;
    w.addSpacer();
    const row = w.addStack();
    row.addSpacer();
    addSymbol(row, period.symbol, 26);
    row.addSpacer();
    w.addSpacer();
    return w;
  }

  if (family === "accessoryRectangular") {
    const header = w.addStack();
    header.centerAlignContent();
    addSymbol(header, period.symbol, 11);
    header.addSpacer(4);
    const h = header.addText(period.label);
    h.font = Font.semiboldSystemFont(10);
    h.textOpacity = 0.75;
    w.addSpacer(2);
    const t = w.addText(text);
    t.font = Font.semiboldSystemFont(14);
    t.minimumScaleFactor = 0.6;
    t.lineLimit = 3;
    return w;
  }

  // Home Screen sizes (small / medium / large) and in-app preview
  const grad = new LinearGradient();
  grad.locations = [0, 1];
  grad.colors = {
    morning:   [new Color("#FDB97D"), new Color("#F3787A")],
    afternoon: [new Color("#4FACFE"), new Color("#2F6FD6")],
    evening:   [new Color("#2B2154"), new Color("#0F0C29")],
  }[periodKey];
  w.backgroundGradient = grad;
  w.setPadding(14, 14, 14, 14);

  const header = w.addStack();
  header.centerAlignContent();
  addSymbol(header, period.symbol, 14);
  header.addSpacer(6);
  const h = header.addText(period.label);
  h.font = Font.boldSystemFont(11);
  h.textColor = Color.white();
  h.textOpacity = 0.85;

  w.addSpacer();
  const t = w.addText(text);
  t.font = Font.boldSystemFont(family === "small" ? 16 : 20);
  t.textColor = Color.white();
  t.minimumScaleFactor = 0.5;
  w.addSpacer();
  return w;
}

const widget = buildWidget();

if (config.runsInWidget || config.runsInAccessoryWidget) {
  Script.setWidget(widget);
} else {
  // Running inside the app: preview the Home Screen version
  await widget.presentMedium();
}
Script.complete();

1. Add the script

  1. Tap Copy on the code above.
  2. Open Scriptable and tap + to create a new script.
  3. Paste everything, name it Daily Affirmations, and tap Done.
  4. Tap the script once to preview it.

2. Put it on your Lock Screen

  1. Lock your phone, then long-press the Lock Screen and tap Customize → Lock Screen.
  2. Tap the widget area under the clock and choose Scriptable.
  3. Pick the rectangular widget (the wide one). It shows the most text.
  4. Tap the new widget, then under Script choose Daily Affirmations.
  5. Tap Done.

Want it on your Home Screen too? Add a small or medium Scriptable widget and choose the same script. It gets a soft gradient that changes with the time of day.

Make it yours

The three lists sit at the top of the script: MORNING, AFTERNOON and EVENING. Edit any line, delete the ones that don't fit you, or add your own. Keep each one in quotes with a comma after it.

To check a part of the day without waiting, long-press the widget, tap Edit Widget, and type morning, afternoon or evening into Parameter. Clear it again afterwards.

Troubleshooting

It didn't change at noon. iOS decides exactly when widgets refresh. The widget asks for an update at 5:00, 12:00 and 18:00, and usually gets it within minutes, sometimes a bit later.

The text is cut off. Use the rectangular widget on the Lock Screen. The circular one only shows the time-of-day icon, and the inline one fits a single line.

If it makes your mornings a bit better, tell me. Tag @cezarhere.