diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md index 368813ecf..88d3197af 100644 --- a/THIRD_PARTY_NOTICES.md +++ b/THIRD_PARTY_NOTICES.md @@ -36,3 +36,15 @@ SOFTWARE. developers, with one upstream fix applied ([gfx-rs/wgpu#10124](https://github.com/gfx-rs/wgpu/pull/10124)). It is licensed under MIT or Apache-2.0; both licenses are in that folder (`LICENSE.MIT`, `LICENSE.APACHE`). + +## Pixelify Sans + +`crates/horizon-theme/fonts/PixelifySans-*.ttf` is [Pixelify Sans](https://github.com/eifetx/Pixelify-Sans) +by The Pixelify Sans Project Authors, licensed under the SIL Open Font License 1.1 +(`crates/horizon-theme/fonts/OFL-PixelifySans.txt`). + +## Pixelarticons + +`crates/horizon-theme/icons/pixel/*.svg` are icons from +[Pixelarticons](https://github.com/halfmage/pixelarticons) by Gerrit Halfmann, under the MIT +license (`crates/horizon-theme/icons/pixel/LICENSE-pixelarticons.txt`). diff --git a/crates/horizon-theme/Cargo.toml b/crates/horizon-theme/Cargo.toml index a2fc2eead..3cc6d2324 100644 --- a/crates/horizon-theme/Cargo.toml +++ b/crates/horizon-theme/Cargo.toml @@ -3,6 +3,6 @@ name = "horizon-theme" version = "0.1.0" edition = "2021" license = "MIT" -description = "Horizon's design tokens and fonts, shared by the launcher and the game's menus" +description = "Horizon's design tokens, fonts and icons, shared by the launcher, the website and the game's menus" [dependencies] diff --git a/crates/horizon-theme/fonts/OFL-PixelifySans.txt b/crates/horizon-theme/fonts/OFL-PixelifySans.txt new file mode 100644 index 000000000..6aa5bfbae --- /dev/null +++ b/crates/horizon-theme/fonts/OFL-PixelifySans.txt @@ -0,0 +1,93 @@ +Copyright 2021 The Pixelify Sans Project Authors (https://github.com/eifetx/Pixelify-Sans) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/crates/horizon-theme/fonts/PixelifySans-Bold.ttf b/crates/horizon-theme/fonts/PixelifySans-Bold.ttf new file mode 100644 index 000000000..5f8040b71 Binary files /dev/null and b/crates/horizon-theme/fonts/PixelifySans-Bold.ttf differ diff --git a/crates/horizon-theme/fonts/PixelifySans-Medium.ttf b/crates/horizon-theme/fonts/PixelifySans-Medium.ttf new file mode 100644 index 000000000..5bf69961d Binary files /dev/null and b/crates/horizon-theme/fonts/PixelifySans-Medium.ttf differ diff --git a/crates/horizon-theme/fonts/PixelifySans-SemiBold.ttf b/crates/horizon-theme/fonts/PixelifySans-SemiBold.ttf new file mode 100644 index 000000000..45cd4e2af Binary files /dev/null and b/crates/horizon-theme/fonts/PixelifySans-SemiBold.ttf differ diff --git a/crates/horizon-theme/icons/pixel/LICENSE-pixelarticons.txt b/crates/horizon-theme/icons/pixel/LICENSE-pixelarticons.txt new file mode 100644 index 000000000..4be35e8f2 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/LICENSE-pixelarticons.txt @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Gerrit Halfmann + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/crates/horizon-theme/icons/pixel/archive.svg b/crates/horizon-theme/icons/pixel/archive.svg new file mode 100644 index 000000000..03033f96d --- /dev/null +++ b/crates/horizon-theme/icons/pixel/archive.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/arrow-left.svg b/crates/horizon-theme/icons/pixel/arrow-left.svg new file mode 100644 index 000000000..96905e6c1 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/arrow-left.svg @@ -0,0 +1,4 @@ + + + + diff --git a/crates/horizon-theme/icons/pixel/book-open.svg b/crates/horizon-theme/icons/pixel/book-open.svg new file mode 100644 index 000000000..b9b134ccc --- /dev/null +++ b/crates/horizon-theme/icons/pixel/book-open.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/box.svg b/crates/horizon-theme/icons/pixel/box.svg new file mode 100644 index 000000000..68f58c8ed --- /dev/null +++ b/crates/horizon-theme/icons/pixel/box.svg @@ -0,0 +1,4 @@ + + + + diff --git a/crates/horizon-theme/icons/pixel/bug.svg b/crates/horizon-theme/icons/pixel/bug.svg new file mode 100644 index 000000000..cdc707a44 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/bug.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/crates/horizon-theme/icons/pixel/check.svg b/crates/horizon-theme/icons/pixel/check.svg new file mode 100644 index 000000000..e8dec6fe8 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/check.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/chevron-down.svg b/crates/horizon-theme/icons/pixel/chevron-down.svg new file mode 100644 index 000000000..472e5e0d0 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/chevron-down.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/chevron-right.svg b/crates/horizon-theme/icons/pixel/chevron-right.svg new file mode 100644 index 000000000..ad8a9142c --- /dev/null +++ b/crates/horizon-theme/icons/pixel/chevron-right.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/clock.svg b/crates/horizon-theme/icons/pixel/clock.svg new file mode 100644 index 000000000..e17594f98 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/clock.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/close.svg b/crates/horizon-theme/icons/pixel/close.svg new file mode 100644 index 000000000..6e6d81257 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/close.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/download.svg b/crates/horizon-theme/icons/pixel/download.svg new file mode 100644 index 000000000..122cfbd80 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/download.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/crates/horizon-theme/icons/pixel/external-link.svg b/crates/horizon-theme/icons/pixel/external-link.svg new file mode 100644 index 000000000..7058bc5b7 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/external-link.svg @@ -0,0 +1,4 @@ + + + + diff --git a/crates/horizon-theme/icons/pixel/folder.svg b/crates/horizon-theme/icons/pixel/folder.svg new file mode 100644 index 000000000..40533e4bb --- /dev/null +++ b/crates/horizon-theme/icons/pixel/folder.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/gamepad.svg b/crates/horizon-theme/icons/pixel/gamepad.svg new file mode 100644 index 000000000..9936d5e66 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/gamepad.svg @@ -0,0 +1,4 @@ + + + + diff --git a/crates/horizon-theme/icons/pixel/globe.svg b/crates/horizon-theme/icons/pixel/globe.svg new file mode 100644 index 000000000..3b984aa0c --- /dev/null +++ b/crates/horizon-theme/icons/pixel/globe.svg @@ -0,0 +1,4 @@ + + + + diff --git a/crates/horizon-theme/icons/pixel/heart.svg b/crates/horizon-theme/icons/pixel/heart.svg new file mode 100644 index 000000000..7c0ccb9eb --- /dev/null +++ b/crates/horizon-theme/icons/pixel/heart.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/home.svg b/crates/horizon-theme/icons/pixel/home.svg new file mode 100644 index 000000000..f71cb8c00 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/home.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/image.svg b/crates/horizon-theme/icons/pixel/image.svg new file mode 100644 index 000000000..cf2892770 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/image.svg @@ -0,0 +1,4 @@ + + + + diff --git a/crates/horizon-theme/icons/pixel/info-box.svg b/crates/horizon-theme/icons/pixel/info-box.svg new file mode 100644 index 000000000..04128032b --- /dev/null +++ b/crates/horizon-theme/icons/pixel/info-box.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/message.svg b/crates/horizon-theme/icons/pixel/message.svg new file mode 100644 index 000000000..c5dc11a7e --- /dev/null +++ b/crates/horizon-theme/icons/pixel/message.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/monitor.svg b/crates/horizon-theme/icons/pixel/monitor.svg new file mode 100644 index 000000000..52edf4d4f --- /dev/null +++ b/crates/horizon-theme/icons/pixel/monitor.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/notes.svg b/crates/horizon-theme/icons/pixel/notes.svg new file mode 100644 index 000000000..beb8d97e5 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/notes.svg @@ -0,0 +1,4 @@ + + + + diff --git a/crates/horizon-theme/icons/pixel/package.svg b/crates/horizon-theme/icons/pixel/package.svg new file mode 100644 index 000000000..cc6ce0788 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/package.svg @@ -0,0 +1,4 @@ + + + + diff --git a/crates/horizon-theme/icons/pixel/play.svg b/crates/horizon-theme/icons/pixel/play.svg new file mode 100644 index 000000000..02e3c17aa --- /dev/null +++ b/crates/horizon-theme/icons/pixel/play.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/plus.svg b/crates/horizon-theme/icons/pixel/plus.svg new file mode 100644 index 000000000..cd35642b9 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/plus.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/reload.svg b/crates/horizon-theme/icons/pixel/reload.svg new file mode 100644 index 000000000..3458d03f0 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/reload.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/crates/horizon-theme/icons/pixel/search.svg b/crates/horizon-theme/icons/pixel/search.svg new file mode 100644 index 000000000..7dce1b5ea --- /dev/null +++ b/crates/horizon-theme/icons/pixel/search.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/server.svg b/crates/horizon-theme/icons/pixel/server.svg new file mode 100644 index 000000000..7979820e7 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/server.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/sliders.svg b/crates/horizon-theme/icons/pixel/sliders.svg new file mode 100644 index 000000000..c2b4912d0 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/sliders.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/crates/horizon-theme/icons/pixel/terminal.svg b/crates/horizon-theme/icons/pixel/terminal.svg new file mode 100644 index 000000000..e000cd104 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/terminal.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/trash.svg b/crates/horizon-theme/icons/pixel/trash.svg new file mode 100644 index 000000000..f67fe4eca --- /dev/null +++ b/crates/horizon-theme/icons/pixel/trash.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/user.svg b/crates/horizon-theme/icons/pixel/user.svg new file mode 100644 index 000000000..13773d116 --- /dev/null +++ b/crates/horizon-theme/icons/pixel/user.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/icons/pixel/zap.svg b/crates/horizon-theme/icons/pixel/zap.svg new file mode 100644 index 000000000..93ab75cbf --- /dev/null +++ b/crates/horizon-theme/icons/pixel/zap.svg @@ -0,0 +1,3 @@ + + + diff --git a/crates/horizon-theme/src/lib.rs b/crates/horizon-theme/src/lib.rs index e9e397389..dac5bf8d2 100644 --- a/crates/horizon-theme/src/lib.rs +++ b/crates/horizon-theme/src/lib.rs @@ -11,6 +11,9 @@ use std::time::Duration; pub const FONT: &str = "Geist"; pub const MONO: &str = "Geist Mono"; +/// The launcher's and the website's display face (headings, navigation, buttons, badges only): +/// Pixelify Sans, bundled under the SIL Open Font License (`fonts/OFL-PixelifySans.txt`). +pub const PIXEL: &str = "Pixelify Sans"; /// The bundled font files. pub mod fonts { @@ -18,6 +21,62 @@ pub mod fonts { pub const GEIST_MEDIUM: &[u8] = include_bytes!("../fonts/Geist-Medium.ttf"); pub const GEIST_SEMIBOLD: &[u8] = include_bytes!("../fonts/Geist-SemiBold.ttf"); pub const GEIST_MONO: &[u8] = include_bytes!("../fonts/GeistMono-Regular.ttf"); + pub const PIXEL_MEDIUM: &[u8] = include_bytes!("../fonts/PixelifySans-Medium.ttf"); + pub const PIXEL_SEMIBOLD: &[u8] = include_bytes!("../fonts/PixelifySans-SemiBold.ttf"); + pub const PIXEL_BOLD: &[u8] = include_bytes!("../fonts/PixelifySans-Bold.ttf"); +} + +/// The launcher's pixel icons: Pixelarticons (MIT, `icons/pixel/LICENSE-pixelarticons.txt`), 24 +/// unit SVGs filled with `currentColor`, by name (`"home"`, `"play"`…). +pub mod icons { + macro_rules! icons { + ($($name:literal),* $(,)?) => { + /// Every icon, `(name, svg)`. + pub const ALL: &[(&str, &[u8])] = &[ + $(($name, include_bytes!(concat!("../icons/pixel/", $name, ".svg")))),* + ]; + }; + } + icons!( + "archive", + "arrow-left", + "book-open", + "box", + "bug", + "check", + "chevron-down", + "chevron-right", + "clock", + "close", + "download", + "external-link", + "folder", + "gamepad", + "globe", + "heart", + "home", + "image", + "info-box", + "message", + "monitor", + "notes", + "package", + "play", + "plus", + "reload", + "search", + "server", + "sliders", + "terminal", + "trash", + "user", + "zap", + ); + + /// An icon's SVG by name. + pub fn get(name: &str) -> Option<&'static [u8]> { + ALL.iter().find(|(n, _)| *n == name).map(|(_, svg)| *svg) + } } /// Horizon's icon at 64 px (PNG), for window title bars and task bars at run time. Rendered from @@ -275,6 +334,113 @@ pub const DARK: Palette = Palette { dark: true, }; +/// The launcher's and the website's blocky look ("Blocks" in `docs/design-system.md`): stone-dark +/// (or lavender-light) neutrals with a violet cast, panels with a dark outline, a light bevel on top +/// and a darker lip below, and the violet `face` of the one big action. The game's menus keep +/// [`LIGHT`] and [`DARK`]. +#[derive(Clone, Copy, Debug, PartialEq, Eq)] +pub struct Blocks { + /// The window behind everything, tiled with a faint stone texture. + pub page: u32, + /// The top bar and the sidebar. + pub side: u32, + /// Panels: rows, cards, dialogs. + pub panel: u32, + /// A selected or hovered panel or row, the open tab. + pub raised: u32, + /// Buttons and the chosen segment. + pub button: u32, + /// A button's top bevel. + pub button_bevel: u32, + /// Sunk wells: fields, tracks, switch and checkbox boxes, segmented tracks. + pub well: u32, + /// The light top (and left) edge of a panel. + pub bevel: u32, + /// The darker bottom edge of a panel or button. + pub lip: u32, + /// The 2 px outline around panels, buttons and wells. + pub outline: u32, + /// Rules between rows inside a panel. + pub rule: u32, + pub ink: u32, + pub ink_soft: u32, + pub muted: u32, + /// Links, focus, progress, the selection marker; text-safe on every background. + pub accent: u32, + /// The main action's face (Play, Install, Download), its top bevel and bottom lip. + pub face: u32, + pub face_bevel: u32, + pub face_lip: u32, + pub on_face: u32, + pub danger: u32, + pub success: u32, + /// "Partly": a mod or pack that runs in part. + pub warn: u32, + pub dark: bool, +} + +pub const BLOCKS_DARK: Blocks = Blocks { + page: 0x0f0d17, + side: 0x0b0a11, + panel: 0x1a1727, + raised: 0x221e34, + button: 0x2b2641, + button_bevel: 0x3d3560, + well: 0x0c0b12, + bevel: 0x342d52, + lip: 0x07060b, + outline: 0x05040a, + rule: 0x120f1c, + ink: 0xecedf3, + ink_soft: 0xc5c7d1, + muted: 0xa29cb8, + accent: 0x9a86ff, + face: 0x5b3fd6, + face_bevel: 0x8a74ff, + face_lip: 0x3a2694, + on_face: 0xffffff, + danger: 0xf07a68, + success: 0x45c27a, + warn: 0xf0b84f, + dark: true, +}; + +pub const BLOCKS_LIGHT: Blocks = Blocks { + page: 0xece7f7, + side: 0xe2dbf2, + panel: 0xf8f6fd, + raised: 0xe9e3f8, + button: 0xddd4f3, + button_bevel: 0xf4f0fe, + well: 0xf3f0fb, + bevel: 0xffffff, + lip: 0xc3b8e2, + outline: 0x2b2244, + rule: 0xe4ddf4, + ink: 0x1b1530, + ink_soft: 0x3b3354, + muted: 0x585071, + accent: 0x5333c9, + face: 0x5b3fd6, + face_bevel: 0x8069ef, + face_lip: 0x3a2694, + on_face: 0xffffff, + danger: 0xa3301d, + success: 0x136336, + warn: 0x7a4f00, + dark: false, +}; + +/// Pixel sizes of the blocky look: outlines, bevels and lips, the cut corner, and the stone tile. +pub const BLOCK_OUTLINE: f32 = 2.; +pub const BLOCK_BEVEL: f32 = 2.; +pub const BLOCK_LIP: f32 = 4.; +/// The stone texture: a 16 by 16 tile, each texel this many logical pixels. +pub const TILE_TEXELS: usize = 16; +pub const TILE_TEXEL: f32 = 4.; +/// The texture's shades: the page colour moved this many levels (of 255) lighter or darker. +pub const TILE_SHADES: [i16; 5] = [0, 2, -2, 5, -4]; + /// How strongly the game's menus veil the live backdrop (the title panorama, or the world behind /// the pause and options screens) with the page colour. Every text colour the menus use keeps /// WCAG AA over it, even on a selected row's plate, with a backdrop as bright as @@ -308,6 +474,41 @@ impl Palette { } } +impl Blocks { + /// Every colour by its CSS name. The website reads the Blocks palettes; the first twelve keep + /// the names of [`Palette::named`] (`plate-soft` is `raised`, `plate` is `button`, `surface` + /// is `panel`, `on-accent` is `on_face`), so styles written for those still apply. + pub fn named(&self) -> [(&'static str, u32); 25] { + [ + ("page", self.page), + ("plate-soft", self.raised), + ("plate", self.button), + ("surface", self.panel), + ("rule", self.rule), + ("ink", self.ink), + ("ink-soft", self.ink_soft), + ("muted", self.muted), + ("accent", self.accent), + ("on-accent", self.on_face), + ("danger", self.danger), + ("success", self.success), + ("warn", self.warn), + ("side", self.side), + ("panel", self.panel), + ("raised", self.raised), + ("button", self.button), + ("button-bevel", self.button_bevel), + ("well", self.well), + ("bevel", self.bevel), + ("lip", self.lip), + ("outline", self.outline), + ("face", self.face), + ("face-bevel", self.face_bevel), + ("face-lip", self.face_lip), + ] + } +} + /// The WCAG 2 contrast ratio of two colours. pub fn contrast(a: u32, b: u32) -> f32 { fn luminance(c: u32) -> f32 { @@ -333,10 +534,12 @@ pub fn css() -> String { let t = format!("{v:.3}"); t.trim_end_matches('0').trim_end_matches('.').to_string() }; - let colors = |s: &mut String, p: &Palette| { + // The website wears the launcher's Blocks look; the game's menus keep LIGHT and DARK. + let colors = |s: &mut String, p: &Blocks| { for (name, c) in p.named() { let _ = writeln!(s, " --{name}: #{c:06x};"); } + let _ = writeln!(s, " --on-face: #{:06x};", p.on_face); let _ = writeln!( s, " color-scheme: {};", @@ -347,11 +550,18 @@ pub fn css() -> String { "/* Generated from crates/horizon-theme by `cargo run -p xtask -- tokens`; do not edit.\n \ docs/design-system.md describes the tokens. */\n\n:root {\n", ); - colors(&mut s, &LIGHT); + colors(&mut s, &BLOCKS_LIGHT); let _ = writeln!( s, - " --font: \"{FONT}\", ui-sans-serif, system-ui, sans-serif;\n --mono: \"{MONO}\", ui-monospace, monospace;" + " --font: \"{FONT}\", ui-sans-serif, system-ui, sans-serif;\n --mono: \"{MONO}\", ui-monospace, monospace;\n --pixel: \"{PIXEL}\", \"{FONT}\", ui-sans-serif, sans-serif;" ); + for (name, v) in [ + ("block-outline", BLOCK_OUTLINE), + ("block-bevel", BLOCK_BEVEL), + ("block-lip", BLOCK_LIP), + ] { + let _ = writeln!(s, " --{name}: {}px;", num(v)); + } for step in TYPE { let size = match step.web { Web::Fixed => format!("{}px", num(step.px)), @@ -410,7 +620,7 @@ pub fn css() -> String { "}\n\n@media (prefers-color-scheme: dark) {\n :root:not([data-theme=\"light\"]) {\n", ); let mut dark = String::new(); - colors(&mut dark, &DARK); + colors(&mut dark, &BLOCKS_DARK); for line in dark.lines() { let _ = writeln!(s, " {line}"); } @@ -458,6 +668,63 @@ mod tests { } } + /// The blocky look: every text colour on every background it is drawn on reaches AA, the + /// main action's label too, and the focus ring (the accent) reaches 3:1 (WCAG 1.4.11). + #[test] + fn blocks_text_meets_wcag_aa_in_both_appearances() { + for p in [BLOCKS_DARK, BLOCKS_LIGHT] { + let theme = if p.dark { "dark" } else { "light" }; + let backgrounds = [ + ("page", p.page), + ("side", p.side), + ("panel", p.panel), + ("raised", p.raised), + ("button", p.button), + ("well", p.well), + ]; + let texts = [ + ("ink", p.ink), + ("ink_soft", p.ink_soft), + ("muted", p.muted), + ("accent", p.accent), + ("danger", p.danger), + ("success", p.success), + ("warn", p.warn), + ]; + for (bn, bg) in backgrounds { + for (tn, fg) in texts { + let ratio = contrast(fg, bg); + assert!(ratio >= 4.5, "{theme} {tn} on {bn}: {ratio:.2}"); + } + // The texture's lightest shade under the page's text. + let lifted = TILE_SHADES.iter().max().copied().unwrap_or(0) as i32; + let shade = [16, 8, 0].iter().fold(0, |out, s| { + let c = (((p.page >> s) & 255) as i32 + lifted).clamp(0, 255) as u32; + out | c << s + }); + for (tn, fg) in texts { + let ratio = contrast(fg, shade); + assert!( + ratio >= 4.5, + "{theme} {tn} on the stone texture: {ratio:.2}" + ); + } + } + let label = contrast(p.on_face, p.face); + assert!(label >= 4.5, "{theme} the main action's label: {label:.2}"); + } + } + + #[test] + fn every_icon_is_a_pixel_svg() { + for (name, svg) in icons::ALL { + let svg = std::str::from_utf8(svg).unwrap(); + assert!(svg.contains("viewBox=\"0 0 24 24\""), "{name}"); + assert!(svg.contains("currentColor"), "{name}"); + } + assert!(icons::get("play").is_some()); + } + /// The game's menus over the brightest backdrop: the page colour veiled over it, and a /// selected row's plate (ink at 8 %) on top. #[test] diff --git a/docs/design-system.md b/docs/design-system.md index be8af11e3..1980adc9c 100644 --- a/docs/design-system.md +++ b/docs/design-system.md @@ -140,15 +140,36 @@ Geist (400, 500, 600) and Geist Mono (400), bundled under the SIL Open Font Lice are index lists with the release name as the title; Settings is an index list of switches and values. The opening is the faint wordmark drawn letter by letter, then the interface arrives. The sunset photograph is gone: the window is the page colour, light or dark with the system. -- **Website** (`website/`): the same page structure as before (what it is, screenshots, - parity, launcher, patch notes, community), each section a `micro` mono label, a `display` - heading and a short paragraph, its content an index list. Screenshots stay as images (radius - 12, no frame). Light and dark follow the system, with a toggle. A giant faint wordmark sits - above the footer. No hero photograph: the first screen is the headline, one paragraph, the - download button and the parity score as an index row. +- **Website** (`website/`): the Blocks look below. The same page structure as before (what it + is, screenshots, parity, launcher, patch notes, community), headings in Pixelify Sans, lists as + stacks of panels, the stone texture behind the page and Horizon's pixel landscape (a dawn or a + sunset) behind the hero. Light and dark follow the system, with a toggle. A giant wordmark in + pixels sits in the footer. - **Game**: vanilla's screens. The on-screen keyboard is a rounded plate of keys in the page colour, the focused key in the accent. +## Blocks + +A blocky, Minecraft-like look in Horizon's purple, for the website and the redesigned launcher: +Minecraft's inventory rather than a document. Its colours are `horizon_theme::Blocks` +(`BLOCKS_LIGHT`, `BLOCKS_DARK`), which `tokens.css` carries under the same names as before plus +`--panel`, `--raised`, `--button`, `--well`, `--bevel`, `--lip`, `--outline` and the `--face` +of the main action. The game's menus keep `LIGHT` and `DARK`. + +- **Pixel type for what names and what you act on.** Headings, navigation, buttons and the + wordmark use Pixelify Sans (OFL; Medium, SemiBold, Bold); paragraphs and numbers stay in Geist + and Geist Mono so long text reads easily. +- **Blocks, not rounded cards.** Every surface is square: a 2 px dark outline, a 2 px light bevel + along the top and a darker lip along the bottom. The main action is the violet face with its own + bevel and a 4 px lip; it sinks a pixel when pressed. Code and fields are sunk wells. +- **Pixel art drawn in code.** The stone behind the pages is 64 texels of the page colour in five + close shades (`TILE_SHADES`), never Minecraft's stone; the landscape is a banded sky, a sun cut in + slices like the mark, hills and square trees. `website/scripts/art.mjs` draws both. +- **Icons** (the launcher): Pixelarticons (MIT), 24 unit pixel SVGs in + `crates/horizon-theme/icons/pixel/`. +- **Contrast**: every text colour meets WCAG AA (4.5:1) on the panels, the page and the lightest + stone shade in both palettes (`blocks_text_meets_wcag_aa_in_both_appearances`). + ## The mark **Horizon line.** A sun half set below a horizon, drawn as three horizontal bars of 4, 8 and diff --git a/website/LEGAL.md b/website/LEGAL.md index da0a31f28..5a2ea9f15 100644 --- a/website/LEGAL.md +++ b/website/LEGAL.md @@ -21,6 +21,7 @@ cookies. The only requests to other hosts are the browser's calls to `api.github | File | Source | Licence | | --- | --- | --- | | `public/fonts/Geist-Regular.woff2`, `Geist-Medium.woff2`, `Geist-SemiBold.woff2`, `GeistMono-Regular.woff2` | Geist and Geist Mono, from `crates/horizon-theme/fonts` (converted from TTF to WOFF2) | SIL Open Font License 1.1, shipped as `public/fonts/OFL-Geist.txt` | +| `public/fonts/PixelifySans-Medium.woff2`, `PixelifySans-SemiBold.woff2`, `PixelifySans-Bold.woff2` | Pixelify Sans by The Pixelify Sans Project Authors (github.com/eifetx/Pixelify-Sans), from `crates/horizon-theme/fonts` (converted from TTF to WOFF2) | SIL Open Font License 1.1, shipped as `public/fonts/OFL-PixelifySans.txt` | The fonts are self-hosted; nothing is fetched from a font service. @@ -34,11 +35,16 @@ The fonts are self-hosted; nothing is fetched from a font service. No Minecraft logo or wordmark appears anywhere on the site, in images or as text styling. GitHub and Discord appear only as plain text links, without their logos. -## No hero image +## The pixel art -The page opens on type, not a photograph. The launcher's old background -(`launcher/assets/background.jpg`, from backgrounds.supply, licence never confirmed) is gone from -the repository, so the launcher's screenshots no longer show it. +| Files in `public/media/` | Source | Licence | +| --- | --- | --- | +| `stone-light.png`, `stone-dark.png` | The page's stone texture, drawn in code by `scripts/art.mjs` from the page colours of `crates/horizon-theme` | MIT, Horizon's original work | +| `scene-light.png`, `scene-dark.png` | The hero's landscape (a dawn and a sunset with Horizon's sliced sun), drawn in code by `scripts/art.mjs`, the same drawing as the launcher's Home banner (`launcher/src/art.rs`) | MIT, Horizon's original work | + +No Minecraft texture is used: the stone is not Minecraft's stone, only shades of the page colour. +The launcher's old background (`launcher/assets/background.jpg`, from backgrounds.supply, licence +never confirmed) is gone from the repository, so the launcher's screenshots no longer show it. ## Screenshots diff --git a/website/README.md b/website/README.md index b5a3ac51d..36c76c331 100644 --- a/website/README.md +++ b/website/README.md @@ -4,9 +4,9 @@ Live at **https://playhorizon.dev**. A landing page and a documentation section in Horizon's design language (`docs/design-system.md`), with the tokens of `crates/horizon-theme` (generated into `src/tokens.css` by `cargo run -p xtask -- tokens`): -Geist and Geist Mono, cool neutrals in a light and a dark appearance (the system's, or the -toggle's) and one violet accent, numbered index lists with one-pixel rules, and short, eased -motion. A headline and the download, then a scroll through what it is, the screenshots, the parity grid, the launcher, the patch +the Blocks look: Pixelify Sans headings over Geist text, Horizon's purple in a light and a dark +appearance (the system's, or the toggle's), square panels with an outline, a bevel and a lip, a +stone texture and a pixel landscape drawn in code (`scripts/art.mjs`), and short, eased motion. A headline and the download, then a scroll through what it is, the screenshots, the parity grid, the launcher, the patch notes, the community links and the contributors. Plain HTML, CSS and JavaScript; no framework and no runtime dependencies. @@ -28,7 +28,8 @@ src/markdown.js a small Markdown renderer (escapes everything), shared by bui src/releases.js the patch notes' markup, shared by build and page src/contributors.js the contributors' filtering and markup, shared by build and page public/ fonts, screenshots, icons, og.png, robots.txt: copied as is (sitemap.xml is written by the build) -scripts/assets.mjs rebuilds public/ from the repo (fonts to WOFF2, images to WebP) +scripts/assets.mjs rebuilds public/ from the repo (fonts to WOFF2, images to WebP, the pixel art) +scripts/art.mjs draws the stone tile and the hero's landscape (PNG, one pixel per texel) scripts/shots.mjs Playwright screenshots at every width, and og.png Dockerfile, Caddyfile, railway.json the Railway service LEGAL.md every asset, its source and licence diff --git a/website/public/fonts/OFL-PixelifySans.txt b/website/public/fonts/OFL-PixelifySans.txt new file mode 100644 index 000000000..6aa5bfbae --- /dev/null +++ b/website/public/fonts/OFL-PixelifySans.txt @@ -0,0 +1,93 @@ +Copyright 2021 The Pixelify Sans Project Authors (https://github.com/eifetx/Pixelify-Sans) + +This Font Software is licensed under the SIL Open Font License, Version 1.1. +This license is copied below, and is also available with a FAQ at: +https://scripts.sil.org/OFL + + +----------------------------------------------------------- +SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007 +----------------------------------------------------------- + +PREAMBLE +The goals of the Open Font License (OFL) are to stimulate worldwide +development of collaborative font projects, to support the font creation +efforts of academic and linguistic communities, and to provide a free and +open framework in which fonts may be shared and improved in partnership +with others. + +The OFL allows the licensed fonts to be used, studied, modified and +redistributed freely as long as they are not sold by themselves. The +fonts, including any derivative works, can be bundled, embedded, +redistributed and/or sold with any software provided that any reserved +names are not used by derivative works. The fonts and derivatives, +however, cannot be released under any other type of license. The +requirement for fonts to remain under this license does not apply +to any document created using the fonts or their derivatives. + +DEFINITIONS +"Font Software" refers to the set of files released by the Copyright +Holder(s) under this license and clearly marked as such. This may +include source files, build scripts and documentation. + +"Reserved Font Name" refers to any names specified as such after the +copyright statement(s). + +"Original Version" refers to the collection of Font Software components as +distributed by the Copyright Holder(s). + +"Modified Version" refers to any derivative made by adding to, deleting, +or substituting -- in part or in whole -- any of the components of the +Original Version, by changing formats or by porting the Font Software to a +new environment. + +"Author" refers to any designer, engineer, programmer, technical +writer or other person who contributed to the Font Software. + +PERMISSION & CONDITIONS +Permission is hereby granted, free of charge, to any person obtaining +a copy of the Font Software, to use, study, copy, merge, embed, modify, +redistribute, and sell modified and unmodified copies of the Font +Software, subject to the following conditions: + +1) Neither the Font Software nor any of its individual components, +in Original or Modified Versions, may be sold by itself. + +2) Original or Modified Versions of the Font Software may be bundled, +redistributed and/or sold with any software, provided that each copy +contains the above copyright notice and this license. These can be +included either as stand-alone text files, human-readable headers or +in the appropriate machine-readable metadata fields within text or +binary files as long as those fields can be easily viewed by the user. + +3) No Modified Version of the Font Software may use the Reserved Font +Name(s) unless explicit written permission is granted by the corresponding +Copyright Holder. This restriction only applies to the primary font name as +presented to the users. + +4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font +Software shall not be used to promote, endorse or advertise any +Modified Version, except to acknowledge the contribution(s) of the +Copyright Holder(s) and the Author(s) or with their explicit written +permission. + +5) The Font Software, modified or unmodified, in part or in whole, +must be distributed entirely under this license, and must not be +distributed under any other license. The requirement for fonts to +remain under this license does not apply to any document created +using the Font Software. + +TERMINATION +This license becomes null and void if any of the above conditions are +not met. + +DISCLAIMER +THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE +COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL +DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM +OTHER DEALINGS IN THE FONT SOFTWARE. diff --git a/website/public/fonts/PixelifySans-Bold.woff2 b/website/public/fonts/PixelifySans-Bold.woff2 new file mode 100644 index 000000000..822b98905 Binary files /dev/null and b/website/public/fonts/PixelifySans-Bold.woff2 differ diff --git a/website/public/fonts/PixelifySans-Medium.woff2 b/website/public/fonts/PixelifySans-Medium.woff2 new file mode 100644 index 000000000..cd473f4b6 Binary files /dev/null and b/website/public/fonts/PixelifySans-Medium.woff2 differ diff --git a/website/public/fonts/PixelifySans-SemiBold.woff2 b/website/public/fonts/PixelifySans-SemiBold.woff2 new file mode 100644 index 000000000..d7fd643ca Binary files /dev/null and b/website/public/fonts/PixelifySans-SemiBold.woff2 differ diff --git a/website/public/media/scene-dark.png b/website/public/media/scene-dark.png new file mode 100644 index 000000000..1636c0406 Binary files /dev/null and b/website/public/media/scene-dark.png differ diff --git a/website/public/media/scene-light.png b/website/public/media/scene-light.png new file mode 100644 index 000000000..f57b4eee9 Binary files /dev/null and b/website/public/media/scene-light.png differ diff --git a/website/public/media/stone-dark.png b/website/public/media/stone-dark.png new file mode 100644 index 000000000..0bc940aa7 Binary files /dev/null and b/website/public/media/stone-dark.png differ diff --git a/website/public/media/stone-light.png b/website/public/media/stone-light.png new file mode 100644 index 000000000..ec5f60959 Binary files /dev/null and b/website/public/media/stone-light.png differ diff --git a/website/scripts/art.mjs b/website/scripts/art.mjs new file mode 100644 index 000000000..160d64914 --- /dev/null +++ b/website/scripts/art.mjs @@ -0,0 +1,151 @@ +// Horizon's pixel art for the website, drawn in code like the launcher's (launcher/src/art.rs): +// the stone tile behind the pages and the landscape behind the hero, in both appearances. +// Each texel is one pixel of the PNG; the CSS scales them up with `image-rendering: pixelated`. +// Written by `npm run assets` (or `node scripts/art.mjs`) into public/media/. +import { readFile } from "node:fs/promises"; +import { join, dirname } from "node:path"; +import { fileURLToPath } from "node:url"; +import sharp from "sharp"; + +const site = join(dirname(fileURLToPath(import.meta.url)), ".."); +const repo = join(site, ".."); + +// The same small fixed random sequence as art.rs (xorshift), so the art is the same every time. +function rng(seed) { + let x = seed >>> 0; + return () => { + x = (x ^ (x << 13)) >>> 0; + x = (x ^ (x >>> 17)) >>> 0; + x = (x ^ (x << 5)) >>> 0; + return Math.fround((x >>> 8) / (1 << 24)); + }; +} + +const channels = (c) => [(c >> 16) & 255, (c >> 8) & 255, c & 255]; +const shade = (c, by) => channels(c).reduce((out, v) => (out << 8) | Math.min(255, Math.max(0, v + by)), 0); +const mix = (a, b, t) => { + const [x, y] = [channels(a), channels(b)]; + return x.reduce((out, v, i) => (out << 8) | Math.round(v + (y[i] - v) * t), 0); +}; + +// `n` by `n` texels of stone: the page colour in a few close shades, with darker flecks. +export function stone(page, shades, n) { + const s = shades.map((by) => shade(page, by)); + const next = rng(0x9e3779b9); + const out = Array.from({ length: n * n }, () => { + const v = next(); + return s[v < 0.5 ? 0 : v < 0.78 ? 1 : v < 0.93 ? 2 : 3]; + }); + for (let k = 0; k < Math.floor((n * n) / 50); k++) { + const x = Math.floor(next() * n); + const y = Math.floor(next() * n); + const len = 1 + Math.floor(next() * 3); + for (let i = 0; i < len; i++) { + out[y * n + ((x + i) % n)] = s[4]; + out[((y + 1) % n) * n + ((x + i + 1) % n)] = s[4]; + } + } + return out; +} + +export const SUNSET = { + sky: [0x0a0f2c, 0x26206a, 0x4b2a7e, 0x7c3a88, 0xc4527a, 0xee6e5a, 0xffb25e], + sun: [0xfff6cf, 0xffd272, 0xff9a44], + far: 0x4a2f7e, mid: 0x2b1f5e, near: 0x151a45, top: 0x3d2f80, trees: 0x0e1236, +}; +export const DAWN = { + sky: [0x8d7fd8, 0xa596e2, 0xbcaeea, 0xd2c4f0, 0xe7d2ee, 0xf6dce4, 0xffe6d6], + sun: [0xffffff, 0xfff1d0, 0xffd9a8], + far: 0xa898dc, mid: 0x8676c8, near: 0x6a5ab4, top: 0x9a8ae0, trees: 0x4c3e94, +}; + +// A blocky landscape, `w` by `h` texels: banded sky, a sun half set behind the far hills and cut +// into slices like Horizon's mark, flat clouds, three ridges of hills and a few square trees. +export function scene(p, seed, w, h) { + const next = rng((Math.imul(seed, 0x2545f491) | 1) >>> 0); + const out = new Array(w * h).fill(0); + const horizon = Math.floor((h * 62) / 100); + const band = horizon / p.sky.length; + for (let y = 0; y < h; y++) { + const f = y / band; + const i = Math.min(Math.floor(f), p.sky.length - 1); + const dither = f - i > 0.88 && i + 1 < p.sky.length; + for (let x = 0; x < w; x++) out[y * w + x] = dither && (x + y) % 2 === 1 ? p.sky[i + 1] : p.sky[i]; + } + const rect = (x, y, rw, rh, c) => { + for (let yy = Math.max(y, 0); yy < Math.min(y + rh, h); yy++) + for (let xx = Math.max(x, 0); xx < Math.min(x + rw, w); xx++) out[yy * w + xx] = c; + }; + for (let k = 0; k < 4; k++) { + const cx = Math.floor(next() * w); + const cy = Math.floor(horizon * (0.12 + next() * 0.4)); + const cw = 10 + Math.floor(next() * 14); + const under = p.sky[Math.min(Math.floor(cy / band) + 1, p.sky.length - 1)]; + const c = mix(under, 0xffffff, 0.12); + rect(cx, cy, cw, 2, c); + rect(cx + 3, cy - 2, Math.max(cw - 6, 0), 2, c); + } + const r = Math.floor(h * 0.2); + const [cx, cy] = [Math.floor(w * 0.68), horizon - Math.floor(h * 0.11)]; + for (let dy = -r; dy <= 0; dy++) { + const half = Math.round(Math.sqrt(r * r - dy * dy)); + const t = (dy + r) / r; + const c = p.sun[t < 0.4 ? 0 : t < 0.75 ? 1 : 2]; + if ((cy + dy) % 5 !== 0 || dy < -r * 0.6) rect(cx - half, cy + dy, half * 2, 1, c); + } + const ridge = (base, amp, rough) => { + let [y, v] = [base, 0]; + return Array.from({ length: w }, (_, x) => { + if (x % 2 === 0) { + v = (v + (next() - 0.5) * rough) * 0.86; + y += v + (base - y) * 0.06; + } + return Math.max(Math.round(Math.min(Math.max(y, base - amp), base + amp)), 0); + }); + }; + const layers = [ + [p.far, horizon - h * 0.1, h * 0.12, 3.2, null], + [p.mid, horizon + h * 0.02, h * 0.09, 2.6, null], + [p.near, horizon + h * 0.18, h * 0.07, 2.2, p.top], + ]; + let near = []; + for (const [c, base, amp, rough, top] of layers) { + const hs = ridge(base, amp, rough); + hs.forEach((y, x) => { + for (let yy = Math.min(y, h); yy < h; yy++) out[yy * w + x] = c; + if (top !== null && y < h) out[y * w + x] = top; + }); + near = hs; + } + for (let k = 0; k < Math.floor(w / 26); k++) { + const tx = 4 + Math.floor(next() * (w - 10)); + const ty = near[tx]; + rect(tx - 2, ty - 8, 5, 5, p.trees); + rect(tx - 1, ty - 10, 3, 2, p.trees); + rect(tx, ty - 3, 1, 3, p.trees); + } + return out; +} + +const png = (texels, w, h, file) => + sharp(Buffer.from(texels.flatMap(channels)), { raw: { width: w, height: h, channels: 3 } }) + .png({ compressionLevel: 9, palette: true }) + .toFile(file); + +// The page colours and the stone's shades come from crates/horizon-theme, like tokens.css. +export async function writeArt(media) { + const theme = await readFile(join(repo, "crates/horizon-theme/src/lib.rs"), "utf8"); + const page = (name) => parseInt(theme.match(new RegExp(`pub const ${name}: Blocks = Blocks \\{\\s*page: 0x([0-9a-f]{6})`))[1], 16); + const shades = JSON.parse(`[${theme.match(/TILE_SHADES: \[i16; 5\] = \[([^\]]*)\]/)[1]}]`); + const texels = Number(theme.match(/TILE_TEXELS: usize = (\d+)/)[1]) * 4; + await png(stone(page("BLOCKS_DARK"), shades, texels), texels, texels, join(media, "stone-dark.png")); + await png(stone(page("BLOCKS_LIGHT"), shades, texels), texels, texels, join(media, "stone-light.png")); + const [w, h] = [240, 72]; + await png(scene(SUNSET, 3, w, h), w, h, join(media, "scene-dark.png")); + await png(scene(DAWN, 3, w, h), w, h, join(media, "scene-light.png")); +} + +if (process.argv[1] === fileURLToPath(import.meta.url)) { + await writeArt(join(site, "public", "media")); + console.log("pixel art written to public/media/"); +} diff --git a/website/scripts/assets.mjs b/website/scripts/assets.mjs index 06a21bba0..92b197e7e 100644 --- a/website/scripts/assets.mjs +++ b/website/scripts/assets.mjs @@ -1,4 +1,4 @@ -// Copies the launcher's fonts and the repo's screenshots into public/, +// Copies the launcher's fonts and the repo's screenshots into public/, draws the pixel art, // converted for the web (woff2, webp in two widths). Run it after any of them change: // `npm run assets`. Its output is committed, because Railway builds only website/. import { mkdir, readFile, writeFile, copyFile } from "node:fs/promises"; @@ -6,6 +6,7 @@ import { join, dirname } from "node:path"; import { fileURLToPath } from "node:url"; import sharp from "sharp"; import wawoff2 from "wawoff2"; +import { writeArt } from "./art.mjs"; const site = join(dirname(fileURLToPath(import.meta.url)), ".."); const repo = join(site, ".."); @@ -16,6 +17,9 @@ const fonts = [ "Geist-Medium.ttf", "Geist-SemiBold.ttf", "GeistMono-Regular.ttf", + "PixelifySans-Medium.ttf", + "PixelifySans-SemiBold.ttf", + "PixelifySans-Bold.ttf", ]; // [source, name]; every image becomes media/.webp and media/-800.webp. @@ -37,7 +41,7 @@ for (const font of fonts) { const ttf = await readFile(join(repo, "crates/horizon-theme/fonts", font)); await writeFile(join(pub, "fonts", font.replace(".ttf", ".woff2")), await wawoff2.compress(ttf)); } -for (const licence of ["OFL-Geist.txt"]) { +for (const licence of ["OFL-Geist.txt", "OFL-PixelifySans.txt"]) { await copyFile(join(repo, "crates/horizon-theme/fonts", licence), join(pub, "fonts", licence)); } @@ -47,6 +51,9 @@ for (const [source, name] of images) { await sharp(input).resize({ width: 800 }).webp({ quality: 78 }).toFile(join(pub, "media", `${name}-800.webp`)); } +// The stone tile and the hero's landscape, drawn in code (scripts/art.mjs). +await writeArt(join(pub, "media")); + // The icons (favicon.svg, favicon-32.png, apple-touch-icon.png) come from Horizon's mark: // `cargo run -p xtask -- icons` writes them with the rest of the brand (docs/media/brand). diff --git a/website/src/404.html b/website/src/404.html index d12c91653..3ac1e017a 100644 --- a/website/src/404.html +++ b/website/src/404.html @@ -5,8 +5,8 @@ Not found · Horizon - - + + diff --git a/website/src/docs.html b/website/src/docs.html index 746e84fad..67b282f82 100644 --- a/website/src/docs.html +++ b/website/src/docs.html @@ -5,8 +5,8 @@ {{DOC_TITLE}} · Horizon docs - - + + diff --git a/website/src/index.html b/website/src/index.html index b9ce72cf5..991cab158 100644 --- a/website/src/index.html +++ b/website/src/index.html @@ -5,8 +5,8 @@ Horizon: a Rust rewrite for Minecraft: Java Edition 26.3 - - + + @@ -27,6 +27,7 @@ + @@ -84,6 +85,9 @@ View on GitHub

For Linux x86-64, macOS on Apple Silicon and Windows x64.

+ + +
  1. 01Matches vanilla{{PERCENT}}
  2. 02Differential harnesses{{HARNESSES}}
  3. @@ -91,8 +95,7 @@
  4. 04What changedNotes

Unofficial. Not an official Minecraft product. Not approved by or associated with Mojang or Microsoft.

-
- +
diff --git a/website/src/privacy.html b/website/src/privacy.html index def61dcc9..6190b03c5 100644 --- a/website/src/privacy.html +++ b/website/src/privacy.html @@ -5,8 +5,8 @@ Privacy · Horizon - - + + diff --git a/website/src/style.css b/website/src/style.css index 03004464b..d4e92d125 100644 --- a/website/src/style.css +++ b/website/src/style.css @@ -1,8 +1,7 @@ /* Horizon's design language (docs/design-system.md), set as a page. The tokens come from crates/horizon-theme through src/tokens.css, which build.mjs puts before this file: the - same palette, type, spacing and motion as the launcher and the game's menus. Type is the - interface; content is numbered index lists with one-pixel rules; one violet accent for the - main action, links and focus; space instead of borders; quiet motion. */ + launcher's Blocks palettes, type, spacing and motion. The base below lays out the page; the + "Blocks" section at the end gives it the launcher's blocky, Minecraft-like look. */ @font-face { font-family: "Geist"; src: url("/fonts/Geist-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; } @font-face { font-family: "Geist"; src: url("/fonts/Geist-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; } @@ -499,3 +498,132 @@ figcaption span { font-family: var(--mono); font-size: var(--text-micro); letter @media (pointer: coarse) { .docs-nav li a, .docs-toc a, .docs-bar-title, .docs-bar-link { display: flex; align-items: center; min-height: 44px; } } + +/* --- Blocks: the launcher's look on the page (docs/design-system.md, "Blocks") ------------- + Pixel type for headings and controls, square panels with a dark outline, a light bevel on top + and a darker lip below, the violet face for the main action, sunk wells, a stone texture + behind the page and Horizon's pixel landscape behind the hero. The art is drawn in code + (scripts/art.mjs, like launcher/src/art.rs); nothing in it comes from Minecraft. */ + +@font-face { font-family: "Pixelify Sans"; src: url("/fonts/PixelifySans-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; } +@font-face { font-family: "Pixelify Sans"; src: url("/fonts/PixelifySans-SemiBold.woff2") format("woff2"); font-weight: 600; font-display: swap; } +@font-face { font-family: "Pixelify Sans"; src: url("/fonts/PixelifySans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; } + +:root { + --stone: url("/media/stone-light.png"); + --scene: url("/media/scene-light.png"); + --sky: #8d7fd8; + --panel-edges: inset 0 var(--block-bevel) 0 var(--bevel), inset 0 calc(-1 * var(--block-bevel)) 0 var(--lip); + --radius: 0px; --radius-plate: 0px; --radius-pill: 0px; +} +:root[data-theme="dark"] { --stone: url("/media/stone-dark.png"); --scene: url("/media/scene-dark.png"); --sky: #0a0f2c; } +@media (prefers-color-scheme: dark) { + :root:not([data-theme="light"]) { --stone: url("/media/stone-dark.png"); --scene: url("/media/scene-dark.png"); --sky: #0a0f2c; } +} + +/* The stone: 64 texels of the page colour in close shades, each texel 4 px. */ +body { position: relative; isolation: isolate; } +body::before { + content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; + background: var(--stone) 0 0 / 256px 256px repeat; image-rendering: pixelated; +} + +/* Pixel type for what names and what you act on; paragraphs stay in Geist. */ +.display, .title, .statement, .row-name, .card-title, .release-version, .release-tag, .count, +.fact h3, .features h3, .system h3, .contributors-title, .footer-disclaimer, .footer-word, +.nav-mark, .docs-prose h2, .docs-prose h3, .prose h2, .prose h3, .prose h4, .menu nav a { + font-family: var(--pixel); font-weight: 600; letter-spacing: 0; +} +.display, .count, .footer-word { font-weight: 700; } +.nav-mark { font-size: 18px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; } +code { border-radius: 0; background: var(--well); box-shadow: 0 0 0 1px var(--outline); } + +/* Buttons: blocks with an outline, a bevel and a lip; they sink a pixel when pressed. */ +.button { + border: var(--block-outline) solid var(--outline); border-radius: 0; + font: 500 var(--text-ui) / 1 var(--pixel); + box-shadow: inset 0 var(--block-bevel) 0 var(--button-bevel), inset 0 calc(-1 * var(--block-lip)) 0 var(--lip); + padding-bottom: 2px; +} +.button.large { font-size: 18px; } +.button.primary { background: var(--face); color: var(--on-face); box-shadow: inset 0 var(--block-bevel) 0 var(--face-bevel), inset 0 calc(-1 * var(--block-lip)) 0 var(--face-lip); } +.button.primary:hover { opacity: 1; filter: brightness(1.08); } +.button.secondary { background: var(--button); } +.button.secondary:hover { background: var(--button); filter: brightness(1.06); } +.button.ghost { border-color: transparent; box-shadow: none; } +.button:active { opacity: 1; transform: translateY(1px); box-shadow: inset 0 var(--block-bevel) 0 var(--lip); } +:focus-visible { border-radius: 0; } + +/* The top bar: the sidebar colour with an outline under it, tabs with an accent underline. */ +.nav.is-scrolled, .nav.is-menu { background: var(--side); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: 0 var(--block-outline) 0 var(--outline); } +.nav-links a, .nav-github, .theme-toggle { border-radius: 0; font-family: var(--pixel); font-weight: 500; font-size: 15px; } +.nav-links a:hover, .nav-github:hover, .theme-toggle:hover { background: var(--raised); } +.nav-links a[aria-current] { background: var(--raised); box-shadow: inset 0 -3px 0 var(--accent); } +.theme-toggle { text-transform: none; letter-spacing: 0; } +.menu { background: var(--side); } +.menu nav a { border-bottom: 0; } + +/* Lists become stacks of panels. */ +.index, .systems, .contributors-list { border-top: 0; display: grid; gap: 8px; } +.row, .system, .release, .release:last-of-type, .contributor { border-bottom: 0; border-top: 0; } +.row > a, .row.card, .fact.row, .features li, .system, .release, .contributor, .docs-pager a { + background: var(--panel); border: var(--block-outline) solid var(--outline); box-shadow: var(--panel-edges); + border-radius: 0; +} +.row > a, .row.card, .fact.row, .features li, .system { padding-left: 20px; padding-right: 20px; } +.row > a::before, .row.card::before { display: none; } +.row > a:hover, .row.card:hover, .contributor:hover, .docs-pager a:hover { background: var(--raised); } +.row > a:hover .row-index { color: var(--accent); } +.row-name { font-size: clamp(20px, 2.2vw, 28px); } +.release { padding: 0 20px; } +.release + .release { margin-top: 8px; } +.release .prose { padding-left: 12rem; } +.contributor { padding: 12px 14px; } +.contributors-list { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; } +.contributor-avatar { border-radius: 0; box-shadow: 0 0 0 2px var(--outline); image-rendering: pixelated; } +.release-latest { border-top: 0; padding: 28px; background: var(--panel); border: var(--block-outline) solid var(--outline); box-shadow: var(--panel-edges); } +.system.is-full .system-state { color: var(--success); } + +/* Screenshots and the launcher's screens: square, outlined. */ +.zoom, .screen, .lightbox, .prose pre, .docs-prose figure img { border-radius: 0; box-shadow: 0 0 0 var(--block-outline) var(--outline); } +.tabs { border-radius: 0; background: var(--well); box-shadow: 0 0 0 var(--block-outline) var(--outline); } +.tabs button { border-radius: 0; font-family: var(--pixel); font-weight: 500; font-size: 15px; } +.tabs button[aria-selected="true"] { color: var(--on-face); } +.tab-pill { border-radius: 0; background: var(--face); box-shadow: inset 0 var(--block-bevel) 0 var(--face-bevel), inset 0 calc(-1 * var(--block-bevel)) 0 var(--face-lip); } + +/* The hero: Horizon's landscape under a veil of the page colour, the words on the left. */ +.hero { + position: relative; isolation: isolate; overflow: hidden; + background: var(--scene) 70% 100% / clamp(1200px, 135vw, 2400px) auto no-repeat, var(--sky); image-rendering: pixelated; + border-bottom: var(--block-outline) solid var(--outline); +} +.hero::before { + content: ""; position: absolute; inset: 0; z-index: -1; + background: + linear-gradient(90deg, color-mix(in srgb, var(--page) 92%, transparent) 0%, color-mix(in srgb, var(--page) 78%, transparent) 45%, color-mix(in srgb, var(--page) 0%, transparent) 78%), + linear-gradient(180deg, color-mix(in srgb, var(--page) 0%, transparent) 55%, color-mix(in srgb, var(--page) 70%, transparent) 100%); +} +.hero .kicker span, .hero .kicker { color: var(--ink-soft); } +.hero .lede { color: var(--ink-soft); } +.hero { padding-bottom: clamp(160px, 18vw, 280px); } +.hero-after { padding-top: 40px; } +.hero-after .hero-index { margin-top: 0; max-width: 860px; } +.hero-after .disclaimer { margin-top: 24px; } +@media (max-width: 900px) { + .hero::before { background: color-mix(in srgb, var(--page) 84%, transparent); } +} + +/* Documentation. */ +.docs-bar { background: var(--side); -webkit-backdrop-filter: none; backdrop-filter: none; box-shadow: 0 var(--block-outline) 0 var(--outline); } +.docs-nav li a { border-radius: 0; } +.docs-nav li a[aria-current] { background: var(--raised); box-shadow: inset 4px 0 0 var(--accent); } +.docs-toc a { border-radius: 0; background: var(--button); box-shadow: 0 0 0 var(--block-outline) var(--outline); } +.docs-pager a { box-shadow: var(--panel-edges); } +.docs-prose h2 { border-top: var(--block-outline) solid var(--outline); } +.docs-prose blockquote { border-left: 4px solid var(--accent); background: var(--panel); padding: 10px 16px; box-shadow: 0 0 0 var(--block-outline) var(--outline); } + +/* The footer: the giant wordmark in pixels. */ +.footer { background: var(--side); border-top: var(--block-outline) solid var(--outline); margin-top: 48px; } +.footer-word { color: var(--raised); letter-spacing: 0.02em; } +:root[data-theme="dark"] .footer-word { color: var(--panel); } +@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .footer-word { color: var(--panel); } } diff --git a/website/src/tokens.css b/website/src/tokens.css index d272865cc..816ad5b8e 100644 --- a/website/src/tokens.css +++ b/website/src/tokens.css @@ -2,21 +2,39 @@ docs/design-system.md describes the tokens. */ :root { - --page: #fafafc; - --plate-soft: #f3f3f8; - --plate: #ebecf4; - --surface: #ffffff; - --rule: #e2e3ea; - --ink: #16181f; - --ink-soft: #3b3e49; - --muted: #646875; - --accent: #5b3fd6; + --page: #ece7f7; + --plate-soft: #e9e3f8; + --plate: #ddd4f3; + --surface: #f8f6fd; + --rule: #e4ddf4; + --ink: #1b1530; + --ink-soft: #3b3354; + --muted: #585071; + --accent: #5333c9; --on-accent: #ffffff; - --danger: #b4372a; - --success: #1d7a48; + --danger: #a3301d; + --success: #136336; + --warn: #7a4f00; + --side: #e2dbf2; + --panel: #f8f6fd; + --raised: #e9e3f8; + --button: #ddd4f3; + --button-bevel: #f4f0fe; + --well: #f3f0fb; + --bevel: #ffffff; + --lip: #c3b8e2; + --outline: #2b2244; + --face: #5b3fd6; + --face-bevel: #8069ef; + --face-lip: #3a2694; + --on-face: #ffffff; color-scheme: light; --font: "Geist", ui-sans-serif, system-ui, sans-serif; --mono: "Geist Mono", ui-monospace, monospace; + --pixel: "Pixelify Sans", "Geist", ui-sans-serif, sans-serif; + --block-outline: 2px; + --block-bevel: 2px; + --block-lip: 4px; --text-micro: 11px; --text-micro-line: 1.5; --text-micro-tracking: 0.04em; @@ -88,34 +106,62 @@ @media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { - --page: #0d0e13; - --plate-soft: #181a22; - --plate: #20222c; - --surface: #16181f; - --rule: #24262f; + --page: #0f0d17; + --plate-soft: #221e34; + --plate: #2b2641; + --surface: #1a1727; + --rule: #120f1c; --ink: #ecedf3; --ink-soft: #c5c7d1; - --muted: #8b8f9c; + --muted: #a29cb8; --accent: #9a86ff; - --on-accent: #0d0e13; + --on-accent: #ffffff; --danger: #f07a68; --success: #45c27a; + --warn: #f0b84f; + --side: #0b0a11; + --panel: #1a1727; + --raised: #221e34; + --button: #2b2641; + --button-bevel: #3d3560; + --well: #0c0b12; + --bevel: #342d52; + --lip: #07060b; + --outline: #05040a; + --face: #5b3fd6; + --face-bevel: #8a74ff; + --face-lip: #3a2694; + --on-face: #ffffff; color-scheme: dark; } } :root[data-theme="dark"] { - --page: #0d0e13; - --plate-soft: #181a22; - --plate: #20222c; - --surface: #16181f; - --rule: #24262f; + --page: #0f0d17; + --plate-soft: #221e34; + --plate: #2b2641; + --surface: #1a1727; + --rule: #120f1c; --ink: #ecedf3; --ink-soft: #c5c7d1; - --muted: #8b8f9c; + --muted: #a29cb8; --accent: #9a86ff; - --on-accent: #0d0e13; + --on-accent: #ffffff; --danger: #f07a68; --success: #45c27a; + --warn: #f0b84f; + --side: #0b0a11; + --panel: #1a1727; + --raised: #221e34; + --button: #2b2641; + --button-bevel: #3d3560; + --well: #0c0b12; + --bevel: #342d52; + --lip: #07060b; + --outline: #05040a; + --face: #5b3fd6; + --face-bevel: #8a74ff; + --face-lip: #3a2694; + --on-face: #ffffff; color-scheme: dark; }