forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#102237 - GuillaumeGomez:sidebar-links-color, …
…r=notriddle Migrate sidebar links color to CSS variables and unify themes with ayu Part of rust-lang#98460. This PR does two things: 1. Migrate more theme CSS rules toward CSS variables. 2. Remove `a.current` specific colors depending on the kind of the item behind the link. The `ayu` theme was already doing it this way and I think it makes much more sense like this. You can test it [here](https://rustdoc.crud.net/imperio/sidebar-links-color/lib2/struct.Foo.html) by hovering other module's items in the sidebar (or check the selector `a.current`). cc `@jsha` r? `@notriddle`
- Loading branch information
Showing
5 changed files
with
247 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,233 @@ | ||
// This test checks links colors in sidebar before and after hover. | ||
goto: file://|DOC_PATH|/test_docs/struct.Foo.html | ||
|
||
// This is needed so that the text color is computed. | ||
show-text: true | ||
|
||
// Ayu theme | ||
local-storage: { | ||
"rustdoc-theme": "ayu", | ||
"rustdoc-use-system-theme": "false", | ||
} | ||
reload: | ||
|
||
// Struct | ||
assert-css: ( | ||
".sidebar a.struct:not(.current)", | ||
{"color": "rgb(83, 177, 219)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.struct:not(.current)" | ||
assert-css: ( | ||
".sidebar a.struct:hover", | ||
{"color": "rgb(255, 180, 76)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
// Enum | ||
assert-css: ( | ||
".sidebar a.enum", | ||
{"color": "rgb(83, 177, 219)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.enum" | ||
assert-css: ( | ||
".sidebar a.enum:hover", | ||
{"color": "rgb(255, 180, 76)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
// Union | ||
assert-css: ( | ||
".sidebar a.union", | ||
{"color": "rgb(83, 177, 219)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.union" | ||
assert-css: ( | ||
".sidebar a.union:hover", | ||
{"color": "rgb(255, 180, 76)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
// Trait | ||
assert-css: ( | ||
".sidebar a.trait", | ||
{"color": "rgb(83, 177, 219)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.trait" | ||
assert-css: ( | ||
".sidebar a.trait:hover", | ||
{"color": "rgb(255, 180, 76)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
// Function | ||
assert-css: ( | ||
".sidebar a.fn", | ||
{"color": "rgb(83, 177, 219)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.fn" | ||
assert-css: ( | ||
".sidebar a.fn:hover", | ||
{"color": "rgb(255, 180, 76)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
// Type definition | ||
assert-css: ( | ||
".sidebar a.type", | ||
{"color": "rgb(83, 177, 219)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.type" | ||
assert-css: ( | ||
".sidebar a.type:hover", | ||
{"color": "rgb(255, 180, 76)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
// Keyword | ||
assert-css: ( | ||
".sidebar a.keyword", | ||
{"color": "rgb(83, 177, 219)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.keyword" | ||
assert-css: ( | ||
".sidebar a.keyword:hover", | ||
{"color": "rgb(255, 180, 76)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
|
||
// Dark theme | ||
local-storage: {"rustdoc-theme": "dark"} | ||
reload: | ||
|
||
// Struct | ||
assert-css: ( | ||
".sidebar a.struct:not(.current)", | ||
{"color": "rgb(253, 191, 53)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.struct:not(.current)" | ||
assert-css: ( | ||
".sidebar a.struct:hover", | ||
{"color": "rgb(253, 191, 53)", "background-color": "rgb(68, 68, 68)"}, | ||
) | ||
// Enum | ||
assert-css: ( | ||
".sidebar a.enum", | ||
{"color": "rgb(253, 191, 53)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.enum" | ||
assert-css: ( | ||
".sidebar a.enum:hover", | ||
{"color": "rgb(253, 191, 53)", "background-color": "rgb(68, 68, 68)"}, | ||
) | ||
// Union | ||
assert-css: ( | ||
".sidebar a.union", | ||
{"color": "rgb(253, 191, 53)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.union" | ||
assert-css: ( | ||
".sidebar a.union:hover", | ||
{"color": "rgb(253, 191, 53)", "background-color": "rgb(68, 68, 68)"}, | ||
) | ||
// Trait | ||
assert-css: ( | ||
".sidebar a.trait", | ||
{"color": "rgb(253, 191, 53)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.trait" | ||
assert-css: ( | ||
".sidebar a.trait:hover", | ||
{"color": "rgb(253, 191, 53)", "background-color": "rgb(68, 68, 68)"}, | ||
) | ||
// Function | ||
assert-css: ( | ||
".sidebar a.fn", | ||
{"color": "rgb(253, 191, 53)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.fn" | ||
assert-css: ( | ||
".sidebar a.fn:hover", | ||
{"color": "rgb(253, 191, 53)", "background-color": "rgb(68, 68, 68)"}, | ||
) | ||
// Type definition | ||
assert-css: ( | ||
".sidebar a.type", | ||
{"color": "rgb(253, 191, 53)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.type" | ||
assert-css: ( | ||
".sidebar a.type:hover", | ||
{"color": "rgb(253, 191, 53)", "background-color": "rgb(68, 68, 68)"}, | ||
) | ||
// Keyword | ||
assert-css: ( | ||
".sidebar a.keyword", | ||
{"color": "rgb(253, 191, 53)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.keyword" | ||
assert-css: ( | ||
".sidebar a.keyword:hover", | ||
{"color": "rgb(253, 191, 53)", "background-color": "rgb(68, 68, 68)"}, | ||
) | ||
|
||
// Light theme | ||
local-storage: {"rustdoc-theme": "light"} | ||
reload: | ||
|
||
// Struct | ||
assert-css: ( | ||
".sidebar a.struct:not(.current)", | ||
{"color": "rgb(53, 109, 164)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.struct:not(.current)" | ||
assert-css: ( | ||
".sidebar a.struct:hover", | ||
{"color": "rgb(53, 109, 164)", "background-color": "rgb(255, 255, 255)"}, | ||
) | ||
// Enum | ||
assert-css: ( | ||
".sidebar a.enum", | ||
{"color": "rgb(53, 109, 164)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.enum" | ||
assert-css: ( | ||
".sidebar a.enum:hover", | ||
{"color": "rgb(53, 109, 164)", "background-color": "rgb(255, 255, 255)"}, | ||
) | ||
// Union | ||
assert-css: ( | ||
".sidebar a.union", | ||
{"color": "rgb(53, 109, 164)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.union" | ||
assert-css: ( | ||
".sidebar a.union:hover", | ||
{"color": "rgb(53, 109, 164)", "background-color": "rgb(255, 255, 255)"}, | ||
) | ||
// Trait | ||
assert-css: ( | ||
".sidebar a.trait", | ||
{"color": "rgb(53, 109, 164)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.trait" | ||
assert-css: ( | ||
".sidebar a.trait:hover", | ||
{"color": "rgb(53, 109, 164)", "background-color": "rgb(255, 255, 255)"}, | ||
) | ||
// Function | ||
assert-css: ( | ||
".sidebar a.fn", | ||
{"color": "rgb(53, 109, 164)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.fn" | ||
assert-css: ( | ||
".sidebar a.fn:hover", | ||
{"color": "rgb(53, 109, 164)", "background-color": "rgb(255, 255, 255)"}, | ||
) | ||
// Type definition | ||
assert-css: ( | ||
".sidebar a.type", | ||
{"color": "rgb(53, 109, 164)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.type" | ||
assert-css: ( | ||
".sidebar a.type:hover", | ||
{"color": "rgb(53, 109, 164)", "background-color": "rgb(255, 255, 255)"}, | ||
) | ||
// Keyword | ||
assert-css: ( | ||
".sidebar a.keyword", | ||
{"color": "rgb(53, 109, 164)", "background-color": "rgba(0, 0, 0, 0)"}, | ||
) | ||
move-cursor-to: ".sidebar a.keyword" | ||
assert-css: ( | ||
".sidebar a.keyword:hover", | ||
{"color": "rgb(53, 109, 164)", "background-color": "rgb(255, 255, 255)"}, | ||
) |