Skip to content

Commit

Permalink
Rollup merge of rust-lang#92854 - Urgau:better-rust-logo, r=Guillaume…
Browse files Browse the repository at this point in the history
…Gomez

Use the updated Rust logo in rustdoc

This pull-request use the updated Rust logo from rust-lang/rust-artwork#9 and also change the logo format from PNG to SVG.

| Before | After |
| --- | --- |
| ![Screenshot 2022-01-13 at 14-33-40 std - Rust](https://user-images.githubusercontent.com/3616612/149342697-7afe4c3e-2be5-444b-86f3-118712b4f7ae.png) | ![Screenshot 2022-01-13 at 14-33-15 std - Rust](https://user-images.githubusercontent.com/3616612/149342705-54ed27c6-0806-4c2d-baa1-4d65ed897e2b.png) |

I also took the liberty to update the two PNG favicons with the SVG reducing their size by ~35% each.

Fixes rust-lang#92831

r? ``@jsha``
  • Loading branch information
matthiaskrgr committed Jan 14, 2022
2 parents d793bd2 + b8ef148 commit 93b3c2c
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/librustdoc/html/render/write_shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ pub(super) fn write_shared(
}

if (*cx.shared).layout.logo.is_empty() {
write_toolchain("rust-logo.png", static_files::RUST_LOGO)?;
write_toolchain("rust-logo.svg", static_files::RUST_LOGO_SVG)?;
}
if (*cx.shared).layout.favicon.is_empty() {
write_toolchain("favicon.svg", static_files::RUST_FAVICON_SVG)?;
Expand Down
Binary file modified src/librustdoc/html/static/images/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/librustdoc/html/static/images/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed src/librustdoc/html/static/images/rust-logo.png
Binary file not shown.
61 changes: 61 additions & 0 deletions src/librustdoc/html/static/images/rust-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions src/librustdoc/html/static_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,9 @@ crate static LICENSE_APACHE: &[u8] = include_bytes!("static/LICENSE-APACHE.txt")
/// The contents of `LICENSE-MIT.txt`, the text of the MIT License.
crate static LICENSE_MIT: &[u8] = include_bytes!("static/LICENSE-MIT.txt");

/// The contents of `rust-logo.png`, the default icon of the documentation.
crate static RUST_LOGO: &[u8] = include_bytes!("static/images/rust-logo.png");
/// The contents of `rust-logo.svg`, the default icon of the documentation.
crate static RUST_LOGO_SVG: &[u8] = include_bytes!("static/images/rust-logo.svg");

/// The default documentation favicons (SVG and PNG fallbacks)
crate static RUST_FAVICON_SVG: &[u8] = include_bytes!("static/images/favicon.svg");
crate static RUST_FAVICON_PNG_16: &[u8] = include_bytes!("static/images/favicon-16x16.png");
Expand Down
4 changes: 2 additions & 2 deletions src/librustdoc/templates/page.html
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
{%- if !layout.logo.is_empty() %}
<img src="{{layout.logo}}" alt="logo"> {#- -#}
{%- else -%}
<img class="rust-logo" src="{{static_root_path|safe}}rust-logo{{page.resource_suffix}}.png" alt="logo"> {#- -#}
<img class="rust-logo" src="{{static_root_path|safe}}rust-logo{{page.resource_suffix}}.svg" alt="logo"> {#- -#}
{%- endif -%}
</div>
</a> {#- -#}
Expand All @@ -92,7 +92,7 @@
{%- if !layout.logo.is_empty() %}
<img src="{{layout.logo}}" alt="logo"> {#- -#}
{%- else -%}
<img class="rust-logo" src="{{static_root_path|safe}}rust-logo{{page.resource_suffix}}.png" alt="logo"> {#- -#}
<img class="rust-logo" src="{{static_root_path|safe}}rust-logo{{page.resource_suffix}}.svg" alt="logo"> {#- -#}
{%- endif -%}
</a> {#- -#}
<nav class="sub"> {#- -#}
Expand Down

0 comments on commit 93b3c2c

Please sign in to comment.