philippefichet / sonarlint4netbeans

SonarLint integration for Apache Netbeans
GNU Lesser General Public License v2.1
33 stars 6 forks source link

Support for dark background - Sonar Rule Details #34

Closed luiscla27 closed 2 years ago

luiscla27 commented 2 years ago

Rules are hardly seen when a dark background is active, please see the following screenshot. The expected would be that the text color changes to the {foregroundColor} defined on NetBeans or at least keep the background white regardless of NB Font & Colors settings. image

Product Version: Apache NetBeans IDE 12.5 Updates: Updates available to version NetBeans 8.2 Patch 2 Java: 11.0.9.1; OpenJDK 64-Bit Server VM 11.0.9.1+1 Runtime: OpenJDK Runtime Environment 11.0.9.1+1 System: Windows 10 version 10.0 running on amd64; Cp1252; es_MX (nb)

philippefichet commented 2 years ago

Hello, The "Sonar Rule Details" window is not part of the code editor and can't be customized like that. It is an HTML view whose style is applied by the theme (LookAndFeel). With the "Dark Nimbus" and "FlatLaf Dark" theme the style is correct, so I think it's a problem with the "Dark Metal" theme. In order to make this view readable anyway, you can customize "Sonar rule details" with CSS. (https://github.com/philippefichet/sonarlint4netbeans#sonar-rule-details-window-stylesheet) Go to Tools/Options/Miscellaneous/SonarLint and click on "Options" and on button "Edit stylesheet for sonar rule detail window". Example: Example

You can use the "Source" tab to see the HTML used for the display

luiscla27 commented 2 years ago

@philippefichet, thank you so much!!

This is the CSS I used:

 p, h1, a, h2, main, div, * {
    text-decoration: none;
    font-family: monospace;
    color: #ffffff;
    line-height: 8px;
    text-indent: 0px;
    margin: 0;
 }
 h1, a, h2 {
     color: #ffcc66;
 }
 code {
    font-weight: bold;
 }
 div {
     color: #ccffff;
 }
 body {
    padding-top: 4px;
    padding-left: 8px;
 }

image