mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-24 17:28:40 +00:00
Alpha-blend borders with backgrounds in quad SDF
Co-Authored-By: Max Brunsfeld <max@zed.dev>
This commit is contained in:
parent
02baaa3529
commit
51c34ebcc2
3 changed files with 12 additions and 6 deletions
|
@ -66,13 +66,19 @@ float4 quad_sdf(QuadFragmentInput input) {
|
|||
border_width = vertical_border;
|
||||
}
|
||||
|
||||
float4 color = input.background_color * float4(1., 1., 1., saturate(0.5 - distance));
|
||||
if (border_width != 0.) {
|
||||
float4 color;
|
||||
if (border_width == 0.) {
|
||||
color = input.background_color;
|
||||
} else {
|
||||
float inset_distance = distance + border_width;
|
||||
color = mix(input.border_color, color, saturate(0.5 - inset_distance));
|
||||
float4 border_color = float4(
|
||||
mix(input.background_color.rgb, input.border_color.rgb, input.border_color.a),
|
||||
saturate(input.background_color.a + input.border_color.a)
|
||||
);
|
||||
color = mix(border_color, input.background_color, saturate(0.5 - inset_distance));
|
||||
}
|
||||
|
||||
return color;
|
||||
return color * float4(1., 1., 1., saturate(0.5 - distance));
|
||||
}
|
||||
|
||||
vertex QuadFragmentInput quad_vertex(
|
||||
|
|
|
@ -7,7 +7,7 @@ extends = "_base"
|
|||
|
||||
[border]
|
||||
0 = "#000000B2"
|
||||
1 = "#FFFFFF16"
|
||||
1 = "#FFFFFF4A"
|
||||
|
||||
[text]
|
||||
0 = { extends = "$text.base", color = "#ffffff" }
|
||||
|
|
|
@ -7,7 +7,7 @@ extends = "_base"
|
|||
|
||||
[border]
|
||||
0 = "#1B222B"
|
||||
1 = "#FFFFFF16"
|
||||
1 = "#FFFFFF4A"
|
||||
|
||||
[text]
|
||||
0 = { extends = "$text.base", color = "#FFFFFF" }
|
||||
|
|
Loading…
Reference in a new issue