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_3

After dark theme:
after_dark_3

@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()));

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

@mbien
Copy link
Member

mbien commented Dec 5, 2024

html-color-invert

what you see here is the html renderer noticing that the contrast is too low and trying to fix it to set the color to the complementary white or black. This is the opposite of what the intention is since it is now highlighting the folder instead of the file.

As previously mentioned the tricky part is to make it work on different background / foregrounds - its used on different components and component states.

I reduced the fade value to 0.7f and computed it for the tabs and tabs-switcher separately, since both have different colors.

faded-folders

Tested on all supported themes and it looks ok I think. The "same background color for same projects" mode is still not working very well, esp on dark themes, but making both decorators work well together won't be easy.

here the commit c4ea291, feel free to squash it with your PR

@troizet troizet force-pushed the improvements_show_parent_folder_name_in_tab_title branch from 7136c44 to 8fa82e7 Compare December 8, 2024 07:31
@troizet
Copy link
Collaborator Author

troizet commented Dec 8, 2024

@mbien, thank you so much for your help!
Sorry, git rebase did not save your authorship. Can you tell me how to get this information back?

@mbien
Copy link
Member

mbien commented Dec 8, 2024

@mbien, thank you so much for your help! Sorry, git rebase did not save your authorship. Can you tell me how to get this information back?

@troizet not a problem with me. But you can add co-authors to commits by appending this to the commit message:

bla bla bla.

Co-authored-by: Duke <[email protected]>

https://docs.github.com/en/pull-requests/committing-changes-to-your-project/creating-and-editing-commits/creating-a-commit-with-multiple-authors

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

Co-authored-by: Michael Bien <[email protected]>
@troizet troizet force-pushed the improvements_show_parent_folder_name_in_tab_title branch from 8fa82e7 to 913d29c Compare December 8, 2024 13:50
@troizet
Copy link
Collaborator Author

troizet commented Dec 8, 2024

@mbien, thank you!
Updated the commit and rebased to the latest master.

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