// This test checks links colors. goto: "file://" + |DOC_PATH| + "/test_docs/index.html" // This is needed so that the text color is computed. show-text: true define-function: ( "check-colors", (theme, mod, macro, struct, enum, trait, fn, type, union, keyword, sidebar, sidebar_current, sidebar_current_background), block { local-storage: { "rustdoc-theme": |theme|, "rustdoc-use-system-theme": "false", } reload: // Checking results colors. assert-css: (".item-table .mod", {"color": |mod|}, ALL) assert-css: (".item-table .macro", {"color": |macro|}, ALL) assert-css: (".item-table .struct", {"color": |struct|}, ALL) assert-css: (".item-table .enum", {"color": |enum|}, ALL) assert-css: (".item-table .trait", {"color": |trait|}, ALL) assert-css: (".item-table .fn", {"color": |fn|}, ALL) assert-css: (".item-table .type", {"color": |type|}, ALL) assert-css: (".item-table .union", {"color": |union|}, ALL) assert-css: (".item-table .keyword", {"color": |keyword|}, ALL) // Checking sidebar elements. assert-css: ( ".sidebar-elems a:not(.current)", {"color": |sidebar|, "background-color": "rgba(0, 0, 0, 0)", "font-weight": "400"}, ALL, ) assert-css: ( ".sidebar-elems a.current", { "color": |sidebar_current|, "background-color": |sidebar_current_background|, "font-weight": "500", }, ALL, ) }, ) call-function: ( "check-colors", { "theme": "ayu", "mod": "rgb(57, 175, 215)", "macro": "rgb(163, 122, 204)", "struct": "rgb(255, 160, 165)", "enum": "rgb(255, 160, 165)", "trait": "rgb(57, 175, 215)", "fn": "rgb(253, 214, 135)", "type": "rgb(255, 160, 165)", "union": "rgb(255, 160, 165)", "keyword": "rgb(57, 175, 215)", "sidebar": "rgb(83, 177, 219)", "sidebar_current": "rgb(255, 180, 76)", "sidebar_current_background": "rgba(0, 0, 0, 0)", }, ) call-function: ( "check-colors", { "theme": "dark", "mod": "rgb(210, 153, 29)", "macro": "rgb(9, 189, 0)", "struct": "rgb(45, 191, 184)", "enum": "rgb(45, 191, 184)", "trait": "rgb(183, 140, 242)", "fn": "rgb(43, 171, 99)", "type": "rgb(45, 191, 184)", "union": "rgb(45, 191, 184)", "keyword": "rgb(210, 153, 29)", "sidebar": "rgb(253, 191, 53)", "sidebar_current": "rgb(253, 191, 53)", "sidebar_current_background": "rgb(68, 68, 68)", }, ) call-function: ( "check-colors", { "theme": "light", "mod": "rgb(56, 115, 173)", "macro": "rgb(6, 128, 0)", "struct": "rgb(173, 55, 138)", "enum": "rgb(173, 55, 138)", "trait": "rgb(110, 79, 201)", "fn": "rgb(173, 124, 55)", "type": "rgb(173, 55, 138)", "union": "rgb(173, 55, 138)", "keyword": "rgb(56, 115, 173)", "sidebar": "rgb(53, 109, 164)", "sidebar_current": "rgb(53, 109, 164)", "sidebar_current_background": "rgb(255, 255, 255)", }, )