Odoo Always Dark

Ensures the Odoo interface always uses the dark theme.

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         Odoo Always Dark
// @description  Ensures the Odoo interface always uses the dark theme.
// @namespace    github.com/brcut-odoo
// @author       brcut-odoo
// @license      MIT 
// @version      0.0.1
// @match        http://*/odoo*
// @match        https://*/odoo*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=odoo.com
// @grant        none
// ==/UserScript==

odoo.define("odoo_always_dark", ["@web/core/utils/patch", "@web/core/browser/cookie", "@web_enterprise/webclient/color_scheme/color_scheme_service"], (require) => {
    'use strict'
    const { patch } = require("@web/core/utils/patch")
    const { cookie } = require("@web/core/browser/cookie")
    const { colorSchemeService } = require("@web_enterprise/webclient/color_scheme/color_scheme_service")

    patch(colorSchemeService, {
        async start(...args) {
            const res = await super.start(...args)
            if (cookie.get("color_scheme") !== "dark") {
                res.switchToColorScheme("dark")
            }
            
            return res
        }
    })

    return {}
})