• Login
Community
  • Login

Invert colour of selected text?

Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
colourinvertthemestyleselection
10 Posts 4 Posters 8.5k Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A
    afender7
    last edited by Apr 10, 2016, 8:44 PM

    Hello, is it possible to have the colour of selected text be inverted, so that I can use a dark colour for text selection without losing legibility (like the block caret does, for instance)?

    Thanks!

    1 Reply Last reply Reply Quote 0
    • D
      decoderman
      last edited by Apr 11, 2016, 4:51 AM

      Settings > Style Configurator
      Select the theme, then the Language you want to edit, then edit away in the Style.

      1 Reply Last reply Reply Quote 0
      • A
        afender7
        last edited by Apr 11, 2016, 11:42 AM

        Thanks for the reply, but the only place that I can see where you can edit the colour of selected text is in the “Global Styles” section, and the “Foreground colour” for “Selected text colour” is greyed out: https://i.gyazo.com/ccc1ecd1bbfd78027b5b371b0f44f10b.png I have also tried manually editing my theme’s xml file, but this doesn’t do anything either.

        C 1 Reply Last reply Apr 11, 2016, 9:51 PM Reply Quote 0
        • C
          Claudia Frank @afender7
          last edited by Apr 11, 2016, 9:51 PM

          Hello @afender7,

          decoderman is right, this is the place to modify your styles.
          It might be that your “mystyle” doesn’t expose all available/needed attributes.
          Compare it with existing themes or the standard/default stylers.xml.

          Cheers
          Claudia

          1 Reply Last reply Reply Quote 0
          • A
            afender7
            last edited by Apr 11, 2016, 10:48 PM

            My xml theme file is a modified copy of the default xml style. At the bottom, in the <GlobalStyles> section, I have added fgColor = “FF0000”, as an example, such that the selected text line is as follows: <WidgetStyle name=“Selected text colour” styleID=“0” fgColor=“FF0000” bgColor=“C0C0C0” fontStyle=“0” />. After having done this, “Foreground colour” is no longer greyed out/unclickable in the Style Configurator for “Selected text colour”, but the changes still aren’t visible: https://gyazo.com/d55957af30deede6e75f692aa8a0b6bb

            I haven’t seen any style thus far that successfully adjusts the foreground colour of selected text, so I wonder if this is even possible.

            1 Reply Last reply Reply Quote 0
            • C
              Claudia Frank
              last edited by Apr 11, 2016, 11:27 PM

              You are correct, I have checked the code and it only reads background value.

              i = stylers.getStylerIndexByName(TEXT("Selected text colour"));
              if (i != -1)
              {
                  Style & style = stylers.getStyler(i);
              	selectColorBack = style._bgColor;
              }
              

              Cheers
              Claudia

              1 Reply Last reply Reply Quote 0
              • A
                afender7
                last edited by Apr 13, 2016, 12:59 AM

                Oh well, that’s a shame. Thank you for confirming, though.

                1 Reply Last reply Reply Quote 0
                • S
                  Scott Sumner
                  last edited by Apr 13, 2016, 12:29 PM

                  This post may (or may not!) be of some use:
                  https://notepad-plus-plus.org/community/topic/11039/foreground-options-for-selected-text

                  1 Reply Last reply Reply Quote 0
                  • C
                    Claudia Frank
                    last edited by Apr 13, 2016, 7:06 PM

                    Hello Scott,

                    shame on me, I should have mentioned the possibility to change
                    the foreground color by using python script and plugin.
                    Thank you for pointing this out.

                    @afender7
                    A script could be written to either change the foreground color per each language
                    or as a general default foreground color.
                    The disadvantage about it is that changing the style back to default or any other theme cannot be easily handled.
                    So if you want to stay with your theme or do not plan to switch themes often,
                    this could be a possible solution.

                    Cheers
                    Claudia

                    1 Reply Last reply Reply Quote 0
                    • A
                      afender7
                      last edited by Apr 13, 2016, 11:05 PM

                      Interesting, thanks, I will have a read of that link!

                      1 Reply Last reply Reply Quote 0
                      1 out of 10
                      • First post
                        1/10
                        Last post
                      The Community of users of the Notepad++ text editor.
                      Powered by NodeBB | Contributors