mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-02 17:44:28 +00:00
Rustdoc label badge for notable traits - Part of rust-lang/rust#156865 - [x] reuse notable trait feature to feed badge data - [x] render it in html - [x] add some html tests - [x] Render a color from a hash from `its full path` - [x] fixed oklch hue-driven palette checked against wcag/apca Should the following be out of scope ? - [ ] Parse color (`#[doc(notable_trait(color="0xff0000")]`) - [ ] display a small colored indicator (with a hover/first letter?) when a type implementing a notable trait is listed outside of its main page - [ ] Some Integration with rust analyzer <img width="315" height="222" alt="Screenshot 2026-05-28 at 14 06 01" src="https://github.com/user-attachments/assets/2b7c19c4-0d6e-4ed7-8901-f82fba7fc122" /> ## Color discussion I went for the higher chroma, even though some values use a fallback, I'm not opposed to go for a less chromatic palette, but that's very bikeshedding so I'll defer to authority. with chroma 0.21: <img width="1048" height="274" alt="Screenshot 2026-06-30 at 21 57 27" src="https://github.com/user-attachments/assets/9f374295-4eb3-43ee-bffa-51276ffa39d2" /> with chroma 0.090: <img width="1037" height="274" alt="Screenshot 2026-06-30 at 21 58 38" src="https://github.com/user-attachments/assets/81d9c5b5-02a8-4f75-969f-0d4fc62bebd0" /> ## History Initially, this PR added a new feature "label_trait", it was then decided in [rustdoc meeting](https://hackmd.io/CxdTcVFTQPmBUrx-PWXTAw?view) to reuse current notable_trait feature.