Odoo Always Dark

Ensures the Odoo interface always uses the dark theme.

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

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.

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

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

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 {}
})