Skip to content

darkModeOn cookie return boolean, not string (enhancement) #14

@ara303

Description

@ara303

Halfmoon's in my new personal website redesign - thanks very much! I just had an idea for a (very) small enhancement...

The cookie darkModeOn could perhaps return a boolean true/false value and not "yes" or "no".

We could then check for it in a more intuitive way, like so:

if (halfmoon.readCookie("darkModeOn")) {
  // 🌑
} else {
  // 🌞
}

This stood out to me because my natural expectation is a boolean value for this, personally.

Maybe this is just a nitpicky opinion thing. Alternatively, maybe instead of darkModeOn the cookie itself could be named mode and then return "light" or "dark"? Any thoughts welcome.

Relevant docs page.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions