Файли
openidea/src/workbench/TitleBar.module.css
T
l0ng-ai 6cd463e9c1 feat(welcome): change any project's colour and icon from the project widget and Welcome screen (#5685)
Projects can show a custom icon instead of the coloured initials: an SVG or
PNG in `.openidea/icon.*` (or IntelliJ's `.idea/icon.*`, with `icon_dark.*`
used in dark themes). Change Project Icon… copies the chosen image there and
Reset Project Icon removes it.

The project context menu in the title bar project widget and on the Welcome
screen now offers Change Project Color…, Change Project Icon… and Reset
Project Icon for open projects as well as recent ones; the colour picker is
a workbench overlay so it opens from any of these places.

Fixes #5613
2026-11-25 05:36:17 +08:00

320 рядки
7.4 KiB
CSS
Неформатований Анотація Історія

Цей файл містить неоднозначні символи Юнікоду
Цей файл містить символи Юнікоду, які можна сплутати з іншими символами. Якщо ви вважаєте, що це зроблено навмисно, можете сміливо ігнорувати це попередження. Щоб показати їх, скористайтеся кнопкою Escape.
.bar {
height: var(--h-titlebar);
flex: none;
display: flex;
align-items: center;
gap: var(--space-1);
padding: 0 8px 0 10px;
white-space: nowrap;
-webkit-user-select: none;
user-select: none;
color: var(--fg-strong);
font-size: var(--fs-chrome);
}
/* Room for the native macOS traffic lights, including in full screen (#4746). */
.overlay {
padding-left: max(82px, calc(82px / var(--titlebar-zoom, 1)));
/* Keep the gear on the icon-only right stripe's centre line, including compact mode. */
padding-right: calc(var(--stripe-outer-padding) + (var(--stripe-icon-button) - var(--titlebar-tool-button)) / 2);
}
/* Welcome window: plain title on the frame colour with a hairline, like IntelliJ's welcome frame. */
.minimal {
background: var(--bg-elev);
box-shadow: inset 0 -1px 0 var(--border);
}
.minimal .windowTitle {
margin-left: var(--space-2);
}
/* Dialog window (Settings): the title sits on the dialog surface, no hairline. */
.dialogBar {
background: var(--bg-dialog, var(--bg-elev));
box-shadow: none;
}
/* IDEA's compact header (Distraction Free, toolbar hidden): the window title, centred. */
.compactHeader {
--h-titlebar: var(--h-compact-header);
}
.overlay.compactHeader {
padding-right: max(82px, calc(82px / var(--titlebar-zoom, 1)));
}
.compactTitle {
flex: 1;
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
text-align: center;
font-size: var(--fs-ui);
color: var(--fg-secondary);
cursor: default;
}
.windowTitle {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
font-size: var(--fs-ui);
font-weight: 600;
color: var(--fg-strong);
cursor: default;
}
.item {
display: flex;
align-items: center;
gap: var(--space-1);
min-width: 0;
}
.bar > .widget,
.item:has([data-toolbar-label]) {
flex: none;
}
.bar [data-toolbar-label] {
min-inline-size: 0;
max-inline-size: min(var(--toolbar-label-width, 100vw), var(--toolbar-label-max, 100vw));
}
/* Main toolbar dropdown widgets. */
.widget {
min-width: 0;
height: var(--h-toolbar-widget);
margin: 0;
padding: 0 8px;
border-radius: var(--radius-toolbar-dropdown);
color: var(--fg-strong);
font-size: var(--fs-chrome);
}
.widget {
gap: var(--space-1-5);
}
.widget:hover,
.widget[aria-expanded="true"] {
background: var(--bg-toolbar-hover);
}
.widgetText {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
}
.chevron {
flex: none;
color: var(--fg-muted);
}
.avatar {
flex: none;
width: 20px;
height: 20px;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: var(--radius-small);
background: linear-gradient(135deg, var(--project-color), var(--project-color-end));
color: var(--fg-button-primary);
--icon-color: currentColor;
font-size: var(--fs-tiny);
font-weight: 600;
letter-spacing: 0.02em;
}
/* IDEA compact: the avatar follows MainToolbar.Button.iconSize (20 → 16). */
.avatar:has(> img) {
background: none;
}
:global(:root[data-compact]) .avatar {
width: 16px;
height: 16px;
font-size: 9px;
}
.drag {
flex: 1;
align-self: stretch;
min-width: 24px;
}
/* Customize Main Toolbar's Center group; toolbarCenter.ts sizes the spacer before it. */
.centerGroup {
flex: none;
display: flex;
align-items: center;
gap: var(--space-1);
}
.tools {
display: flex;
align-items: center;
gap: var(--space-1);
margin-left: 12px;
}
.tool {
width: var(--titlebar-tool-button);
height: var(--titlebar-tool-button);
border-radius: var(--radius-toolbar-button);
color: var(--fg-secondary);
}
/* Frameless window (Windows, Linux): caption buttons sit flush with the right and top edges. */
.frameless {
padding-right: 0;
/* The main menu button leads the left stripe, so the bar starts where the
stripe's own padding does and the two share a centre line. */
padding-left: var(--stripe-outer-padding);
}
/* The desktop puts caption buttons on the left (GTK decoration layout): they take the left
edge, and the right keeps the bar's own padding when no buttons are left there. */
.frameless.captionsAtLeft {
padding-left: 0;
}
.frameless.noCaptionsAtRight {
padding-right: 8px;
}
/* The button heads the tool window stripe below it, so it takes the stripe's
size: both shrink in compact mode. */
.mainMenuButton {
flex: none;
width: var(--stripe-icon-button);
height: var(--stripe-icon-button);
margin-right: 4px;
padding: 0;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: var(--radius-popup);
background: transparent;
color: var(--fg-secondary);
}
.mainMenuButton:hover,
.mainMenuButton[aria-expanded="true"] {
background: var(--bg-toolbar-hover);
}
.mainMenuButton:focus-visible,
.menuTitle:focus-visible,
.caption:focus-visible {
outline: 2px solid var(--focus-ring);
outline-offset: -2px;
}
/* Preserve the menu's natural width while allowing its slot to yield to toolbar controls. */
/* Ends where the stripe column below it does, the bar's padding being the
stripe's own. */
.mainMenuSlot {
position: relative;
flex: 0 1 auto;
min-width: calc(var(--stripe-icon-button) + var(--island-gap));
height: var(--stripe-icon-button);
overflow: hidden;
}
.mainMenuSlot ~ .tools {
flex-shrink: 0;
}
.menuMeasure {
width: max-content;
visibility: hidden;
pointer-events: none;
}
.menuPresentation {
position: absolute;
top: 0;
left: 0;
height: 100%;
display: flex;
align-items: center;
}
/* Main menu › Separate toolbar: the titles in their own row below the title bar. */
.menuRow {
flex: none;
display: flex;
align-items: center;
height: 30px;
padding: 0 8px 0 10px;
-webkit-user-select: none;
user-select: none;
}
/* The main menu titles. */
.menuBar {
flex: none;
display: flex;
align-items: center;
gap: var(--space-0-5);
min-width: 0;
}
.menuTitle {
height: 28px;
padding: 0 7px;
border-radius: var(--radius-popup);
background: transparent;
color: var(--fg-strong);
font-size: var(--fs-ui);
}
.menuTitle:hover,
.menuTitleOpen {
background: var(--bg-toolbar-hover);
}
.captions {
flex: none;
align-self: stretch;
display: flex;
margin-left: 8px;
}
.captionsLeft {
margin-left: 0;
margin-right: 8px;
}
.caption {
width: 46px;
height: 100%;
padding: 0;
display: inline-flex;
align-items: center;
justify-content: center;
border-radius: 0;
background: transparent;
color: var(--fg-strong);
}
.caption:hover {
background: var(--bg-toolbar-hover);
}
.captionClose:hover {
background: var(--caption-close-hover);
color: var(--fg-caption-close-hover);
}
.captionClose:active {
background: var(--caption-close-pressed);
color: var(--fg-caption-close-hover);
}
/* A narrow window leaves more room for widgets and window controls. */
@media (max-width: 560px) {
.bar {
gap: var(--space-0-5);
}
.widget {
padding: 0 4px;
}
.item button:has(> [data-toolbar-label]) {
margin-inline: 0;
padding-inline: var(--space-1);
}
.tools {
margin-left: 2px;
}
.drag {
min-width: 0;
}
.mainMenuButton {
margin-right: 0;
}
.captions {
margin-left: 0;
}
.captionsLeft {
margin-right: 0;
}
.caption {
width: 28px;
}
}
/* The leading icons identify these dropdowns when the toolbar has to use its smallest spacing. */
@media (max-width: 480px) {
.bar [data-toolbar-icon-dropdown] {
gap: var(--space-0-5);
min-inline-size: var(--h-control-small);
padding-inline: var(--space-0-5);
}
.bar [data-toolbar-icon-dropdown] > svg:last-child {
display: none;
}
}