Invert colour of selected text?



  • 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!



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



  • 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.



  • 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



  • 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.



  • 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



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





  • 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



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