Skip to content

Commit

Permalink
fix: enforced light mode (#210)
Browse files Browse the repository at this point in the history
* fix: enable forcing light mode

* docs: add info about enforced light mode
  • Loading branch information
tomosterlund authored Nov 14, 2023
1 parent 9201725 commit 19edf5d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion development/QalendarView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<DevHeader v-if="layout === 'header'" />

<main>
<main class="is-light-mode">
<Qalendar
:key="config.locale + config.week.nDays"
:selected-date="new Date()"
Expand Down
2 changes: 1 addition & 1 deletion development/cypress/CypressSmoke.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div class="page">
<div class="wrapper">
<div class="wrapper is-light-mode">
<Qalendar
:config="config"
/>
Expand Down
6 changes: 6 additions & 0 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ Dark mode is enabled in one out of two ways:
1. User system preferences
2. Set programmatically, by adding the inline style `style="color-scheme: dark"` to a parent element.

::: tip
If you need to enforce light mode, even when a user's system settings are set to dark mode, you can
add the class `is-light-mode` to any element wrapping the calendar. An example of this can be found here:
https://github.com/tomosterlund/qalendar-light-mode-test/blob/main/src/views/Home.vue
:::

## Basic configuration

Qalendar takes a `config` prop, which contains all the most crucial options for configuring its
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "qalendar",
"description": "Event calendar and date picker for Vue 3",
"version": "3.5.0",
"version": "3.5.1-beta.0",
"homepage": "https://tomosterlund.github.io/qalendar/",
"repository": {
"type": "git",
Expand Down
5 changes: 4 additions & 1 deletion src/styles/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@

@mixin dark-mode {
@media (prefers-color-scheme: dark) {
@content;

&:not(.is-light-mode &) {
@content;
}
}

[style*="color-scheme: dark"] & {
Expand Down

0 comments on commit 19edf5d

Please sign in to comment.