sass: Add scrollbar-thumb() function for scrollbar thumb
The scrollbar thumb is the only place where overlay is not used for hover and pressed interactions.
The scrollbar thumb is the only place where overlay is not used for hover and pressed interactions.
by roundabout, Saturday, 6 March 2021, 23:32:48 (1615073568), pushed by roundabout, Sunday, 11 May 2025, 13:22:57 (1746969777)
Author identity: nana-4 <hnmaigo@gmail.com>
0b8f607bdca77799b227cadb2c23f7b01e141f5d
@function entry-fill($color) {
@return rgba($color, if(has-alpha($color), .04, .04));
}
@function scrollbar-thumb($color, $state: null) {
@if $state == null {
@return rgba($color, if(has-alpha($color), .38, .5));
} @else if $state == "hover" {
@return rgba($color, if(has-alpha($color), .48, .6));
} @else if $state == "pressed" {
@return rgba($color, if(has-alpha($color), .6, .7));
} @else if $state == "disabled" {
@return rgba($color, if(has-alpha($color), .26, .3));
} @else {
@error "Invalid type: '#{$state}'";
}
}
@function entry-fill($color) {
@return rgba($color, if(has-alpha($color), .04, .04));
}
@function scrollbar-thumb($color, $state: null) {
@if $state == null {
@return rgba($color, if(has-alpha($color), .38, .5));
} @else if $state == "hover" {
@return rgba($color, if(has-alpha($color), .48, .6));
} @else if $state == "pressed" {
@return rgba($color, if(has-alpha($color), .6, .7));
} @else if $state == "disabled" {
@return rgba($color, if(has-alpha($color), .26, .3));
} @else {
@error "Invalid type: '#{$state}'";
}
}
height: 32px;
border: 4px solid transparent;
border-radius: 8px;
background-color: disabled($on-surface);
background-color: scrollbar-thumb($on-surface);
background-clip: padding-box;
&:horizontal {
}
&:hover {
background-color: hint($on-surface);
background-color: scrollbar-thumb($on-surface, "hover");
}
&:active {
background-color: $on-surface;
background-color: scrollbar-thumb($on-surface, "pressed");
}
&:disabled {
background-color: disabled-hint($on-surface);
background-color: scrollbar-thumb($on-surface, "disabled");
}
}
// would be nice to margin or at least to transparent
// border: 4px solid transparent;
border-radius: (8px / 2);
background-color: disabled($on-surface);
background-color: scrollbar-thumb($on-surface);
&:hover {
background-color: hint($on-surface);
background-color: scrollbar-thumb($on-surface, "hover");
}
&:active {
background-color: $on-surface;
background-color: scrollbar-thumb($on-surface, "pressed");
}
}
}
StButton#vhandle,
StButton#hhandle {
background-color: disabled($on-dark);
background-color: scrollbar-thumb($on-dark);
&:hover {
background-color: hint($on-dark);
background-color: scrollbar-thumb($on-dark, "hover");
}
&:active {
background-color: $on-dark;
background-color: scrollbar-thumb($on-dark, "pressed");
}
}
}
border: 4px solid transparent;
border-radius: $circular-radius;
background-clip: padding-box;
background-color: disabled($on-surface);
background-color: scrollbar-thumb($on-surface);
&:hover {
background-color: hint($on-surface);
background-color: scrollbar-thumb($on-surface, "hover");
}
&:active {
background-color: $on-surface;
background-color: scrollbar-thumb($on-surface, "pressed");
}
&:disabled {
background-color: disabled-hint($on-surface);
background-color: scrollbar-thumb($on-surface, "disabled");
}
}
margin: 4px - 1px;
border: 1px solid rgba($base, .3);
border-radius: $circular-radius;
background-color: disabled($on-surface);
background-color: scrollbar-thumb($on-surface);
background-clip: padding-box;
-gtk-icon-source: none;
&:disabled {
background-color: disabled-hint($on-surface);
background-color: scrollbar-thumb($on-surface, "disabled");
}
}