Skip to content

Commit

Permalink
EmojiButton set right theme
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaudgg committed Dec 1, 2024
1 parent 72cb241 commit 1b1b7b5
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/javascript/controllers/admin/emoji_button_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ export default class extends Controller {
localeEmojiData = itEmojiData;
}

const prefersDarkScheme = window.matchMedia("(prefers-color-scheme: dark)").matches
const hasDarkClass = document.documentElement.classList.contains("dark")
const useDarkTheme = prefersDarkScheme || hasDarkClass
const theme = useDarkTheme ? 'dark' : 'light'

this.application.picker = new EmojiButton({
theme: theme,
initialCategory: 'food',
showRecents: false,
emojisPerRow: 8,
Expand Down

0 comments on commit 1b1b7b5

Please sign in to comment.