From 728d5cc8b58ff28e959eb143c262903f8d762915 Mon Sep 17 00:00:00 2001 From: Luigi D'Acunto Date: Wed, 23 Sep 2026 18:02:26 +0200 Subject: [PATCH] Fix UNKNOWN state color in service name tint The service name tint shown when hiding the State column used a generic color palette instead of Checkmk's own state colors, showing UNKNOWN as purple instead of orange. Now matches the native .state_rounded_fill colors exactly. --- CHANGELOG.md | 5 +++++ README.md | 2 +- user_script/checkmk_swissknife.user.js | 6 ++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2d7a868..09d5032 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to **Checkmk SwissKnife** are documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.22.2] - 2026-09-23 + +### Fixed +- The service name tint applied when hiding the State column now uses Checkmk's actual state colors (green/yellow/red/orange for OK/WARN/CRIT/UNKNOWN) instead of a generic palette — UNKNOWN was showing as purple instead of the native orange. + ## [2.22.1] - 2026-09-23 ### Added diff --git a/README.md b/README.md index 007739f..02877e3 100644 --- a/README.md +++ b/README.md @@ -190,7 +190,7 @@ Applies to: any `view.py` page listing hosts (with or without sidebar). ### Column Visibility Toggle Adds a **"Columns"** dropdown to the menu bar on any monitoring view table. Each entry hides/shows one native Checkmk column — State, Site alias, Host icons, Service icons, Age, Checked, Check command, Groups (service + host) — found by its header text, so it works on any view without being tied to one specific one. Only the columns actually present on the current view are listed, each with its own **ON/OFF** button so it's always clear at a glance what's currently shown, plus **"Show all"**/**"Hide all"** shortcuts at the top of the panel to reset everything in one click. Purely visual (CSS only, never touches form/checkbox state), and the choice is saved so it applies the same way to every monitoring view you open afterwards. -Hiding the **State** column also tints the service name itself with that row's state color (green OK, amber WARN, red CRIT, purple UNKNOWN), so problems stay identifiable at a glance without the column taking up space. +Hiding the **State** column also tints the service name itself with that row's state color (Checkmk's own colors: green OK, yellow WARN, red CRIT, orange UNKNOWN), so problems stay identifiable at a glance without the column taking up space. Applies to: any `view.py` page with a data table (with or without sidebar). diff --git a/user_script/checkmk_swissknife.user.js b/user_script/checkmk_swissknife.user.js index 8d8bf5f..fd4ea1e 100644 --- a/user_script/checkmk_swissknife.user.js +++ b/user_script/checkmk_swissknife.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name Checkmk SwissKnife // @namespace https://luigidacunto.com/ -// @version 2.22.1 +// @version 2.22.2 // @checkmk 2.3.x - 2.4.x // @description Collection of UI improvements for Checkmk WATO. Each fix or enhancement is added here as an independent feature. // @author Luigi D'Acunto @@ -1134,7 +1134,9 @@ localStorage.setItem(COLUMN_VIS_STORAGE_KEY, JSON.stringify([...set])); } - const STATE_COLORS = { '0': '#4caf50', '1': '#e5a500', '2': '#e55b5b', '3': '#a078c8' }; + // Matches Checkmk's own state colors (.state_rounded_fill.state), not an + // arbitrary palette, so the tint reads the same as the native badge would. + const STATE_COLORS = { '0': '#13d389', '1': '#ffd703', '2': '#c83232', '3': '#ff8400' }; // Whenever the State column is hidden (via the Columns dropdown, in any // combination — no separate "Clean view" mode needed), the Service name is