Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1800. TextView now uses the same colors as TextField. #1971

Merged
merged 7 commits into from
Sep 15, 2022

Conversation

BDisp
Copy link
Collaborator

@BDisp BDisp commented Aug 27, 2022

Fixes #1800.

Pull Request checklist:

  • I've named my PR in the form of "Fixes #issue. Terse description."
  • My code follows the style guidelines of Terminal.Gui - if you use Visual Studio, hit CTRL-K-D to automatically reformat your files before committing.
  • My code follows the Terminal.Gui library design guidelines
  • I ran dotnet test before commit
  • I have made corresponding changes to the API documentation (using /// style comments)
  • My changes generate no new warnings
  • I have checked my code and corrected any poor grammar or misspellings
  • I conducted basic QA to assure all features are working

@BDisp
Copy link
Collaborator Author

BDisp commented Aug 29, 2022

This commit 3308ab4 will be needed after the pr #1972 is merged.

Copy link
Collaborator

@tig tig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see my comments.

@tig tig merged commit 09f0054 into gui-cs:develop Sep 15, 2022
tig pushed a commit that referenced this pull request Sep 15, 2022
…1971 has been fixed. (#2012)

* Removing TextView ColorScheme from the Wizard component.

* Changing someText color to be different from the help text color.
@BDisp BDisp deleted the textview-colors-as-textfield branch September 15, 2022 13:43
tznind added a commit to HicServices/RDMP that referenced this pull request Sep 28, 2022
@arakis
Copy link

arakis commented Nov 2, 2022

What is the "right" way to get the old colors / Behavior?

Old Behavior: Blue Background, Gray Text.
Now Gray Background, Darkgray Text.

In my case, I have a border/panel around the view, it looks much more natural to have the background blue.

@tznind
Copy link
Collaborator

tznind commented Nov 2, 2022

Old Behavior: Blue Background, Gray Text. Now Gray Background, Darkgray Text.

In my case, I have a border/panel around the view, it looks much more natural to have the background blue.

You can set the colors by creating a ColorScheme and assigning it to the View. Make sure to only declare after you have called Application.Init ();

For example:

using Terminal.Gui;
using Attribute = Terminal.Gui.Attribute;

Application.Init();
var win = new Window("Example App (Ctrl+Q to quit)");

ColorScheme myscheme = new ColorScheme
{
    // Not Used (Normally Color when NOT tabbed into)
    Normal = new Attribute(
        Color.Red,Color.Black),

    // Not Used (Normally Selected text or Shortcut key when NOT tabbed into
    HotNormal = new Attribute(
        Color.Black,Color.Red),

    // Color of TextView when not readonly
    Focus = new Attribute(
        Color.Red,Color.Black),
    
    // Not Used (Normally the Shortcut color  color when tabbed into)
    HotFocus = new Attribute(
        Color.Black,Color.Red),

    // When ReadOnly
    Disabled = new Attribute(Color.Gray,Color.Black),
    
};
win.Add(
    new TextView()
    {
        Width = Dim.Fill(),
        Height = Dim.Fill() -1,
        ColorScheme = myscheme,
        AllowsTab = false,
    }
);
win.Add(
    new TextField()
    {
        Width = 10,
        Y = Pos.AnchorEnd(1)
    }
);

Application.Run(win);
Application.Shutdown();

redtext

UPDATE: Actually it looks like only Focus is used (and Disabled for when ReadOnly is true). The selection color is just the mirror of Focus (swap background and foreground)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TextView: Default background color has usability issues
4 participants