OpenStreetMap Dark Mode (filter-based)

Dark Mode for OpenStreetMap tiles based on inverting the colors and then rotating the hue.

2024/11/15のページです。最新版はこちら

このスクリプトの質問や評価の投稿はこちら通報はこちらへお寄せください
// ==UserScript==
// @name         OpenStreetMap Dark Mode (filter-based)
// @namespace    http://tampermonkey.net/
// @version      1.0.0
// @description  Dark Mode for OpenStreetMap tiles based on inverting the colors and then rotating the hue.
// @author       scy
// @license      MIT
// @match        *://www.openstreetmap.org/*
// @grant        GM_addStyle
// ==/UserScript==

// SPDX-FileCopyrightText: 2024 scy
// SPDX-License-Identifier: MIT

(function() {
    'use strict';

    GM_addStyle(`
      @media (prefers-color-scheme: dark) {
        /* Revert any filters on the tile container (as in the version that's
         * been rolled out on 2024-11-14). */
        .leaflet-tile-container {
          filter: none;
        }
        /* Add filter to the tile images and map key. */
        .leaflet-tile, .mapkey-table-entry td:first-child > * {
          filter: invert(95%) hue-rotate(180deg);
        }
      }
    `);
})();