Community
    • Login

    Invert colour of selected text?

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    colourinvertthemestyleselection
    10 Posts 4 Posters 9.5k Views 3 Watching
    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.
    • afender7A Offline
      afender7
      last edited by

      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
      • decodermanD Offline
        decoderman
        last edited by

        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
        • afender7A Offline
          afender7
          last edited by

          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.

          Claudia FrankC 1 Reply Last reply Reply Quote 0
          • Claudia FrankC Offline
            Claudia Frank @afender7
            last edited by

            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
            • afender7A Offline
              afender7
              last edited by

              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
              • Claudia FrankC Offline
                Claudia Frank
                last edited by

                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
                • afender7A Offline
                  afender7
                  last edited by

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

                  1 Reply Last reply Reply Quote 0
                  • Scott SumnerS Offline
                    Scott Sumner
                    last edited by

                    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
                    • Claudia FrankC Offline
                      Claudia Frank
                      last edited by

                      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
                      • afender7A Offline
                        afender7
                        last edited by

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

                        1 Reply Last reply Reply Quote 0

                        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                        With your input, this post could be even better 💗

                        Register Login
                        • First post
                          Last post
                        The Community of users of the Notepad++ text editor.
                        Powered by NodeBB | Contributors