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

Small improvements to the “Show parent folder name in tab title” option #7930

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

troizet
Copy link
Collaborator

@troizet troizet commented Oct 31, 2024

Small improvements to the “Show parent folder name in tab title” option:

  • parent folder name is displayed in opened documents list;
  • parent folder name is displayed in a different color from the file name.

Before:
before_2

After:
after_2

After dark theme:
after_dark_2

@troizet troizet added UI User Interface Platform [ci] enable platform tests (platform/*) labels Oct 31, 2024
@troizet troizet requested a review from mbien November 6, 2024 11:04
@mbien
Copy link
Member

mbien commented Nov 7, 2024

I think visually distinguishing file name from path could be useful, but it will be probably tricky to find a color which works on active/inactive tabs for both light and dark themes. (e.g the FlatLaf light screenshot is a bit hard to read for me at least)

The test output window reduces the contrast for less important stack frames for example (#6695 has screenshots).

This is how it computes the color:

private static String hiddenColor() {
// note: the tree adjusts the color automatically if the contrast is too low
// which would have the opposite effect of what we are trying to achieve here
float a = 0.6f;
Color f = UIManager.getColor("Tree.foreground");
Color b = UIManager.getColor("Tree.background");
return String.format("#%02x%02x%02x",
(int)(b.getRed() + a * (f.getRed() - b.getRed())),
(int)(b.getGreen() + a * (f.getGreen() - b.getGreen())),
(int)(b.getBlue() + a * (f.getBlue() - b.getBlue())));
}

It does also use the colors from the actual component as input instead of using a hardcoded value.

@mbien
Copy link
Member

mbien commented Nov 7, 2024

It does also use the colors from the actual component as input instead of using a hardcoded value.

btw If you can't access the actual tab component, this might help to figure out what the key is - if it has one:

    UIManager.getLookAndFeelDefaults().entrySet().stream()
            .filter( t -> t.getValue() instanceof Color)
            .sorted((o1, o2) -> o1.getKey().toString().compareTo(o2.getKey().toString()))
            .forEach(t -> System.out.println(t.getKey()+ ": " + t.getValue()));

- parent folder name is displayed in opened documents list;
- parent folder name is displayed in a different color from the file name.
@troizet troizet force-pushed the improvements_show_parent_folder_name_in_tab_title branch from 1591db6 to 7136c44 Compare November 16, 2024 17:30
@troizet
Copy link
Collaborator Author

troizet commented Nov 16, 2024

@mbien thanks for the example. Made the changes and updated the screenshots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform [ci] enable platform tests (platform/*) UI User Interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants