Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def __init__(
logo_name: str,
space_object: BaseRenderable,
annotations: Annotations,
show_icon_clearspace: bool = False,
**kwargs,
):
self.logo = logo
Expand All @@ -28,6 +29,14 @@ def __init__(

self.recommended = self.logo(clear_space=ClearSpace.RECOMMENDED)
self.minimal = self.logo(clear_space=ClearSpace.MINIMAL)

self.show_icon_clearspace = show_icon_clearspace

if self.show_icon_clearspace:
self.icon = self.logo(clear_space=ClearSpace.ICON)
else:
self.icon = None

super().__init__(**kwargs)

@property
Expand All @@ -48,6 +57,17 @@ def make_filename(self, extras: tuple[str] = ()) -> str:
)

def make_svg_elements(self):
if self.show_icon_clearspace:
print(self.icon)
return (
self.make_greyscale_def(),
self.make_grid_lines(),
self.make_clearspace_lines(),
self.icon.make_svg_elements(),
self.recommended.make_svg_elements(),
self.make_space_object_elements(),
)

return (
self.make_greyscale_def(),
self.make_grid_lines(),
Expand Down Expand Up @@ -170,7 +190,17 @@ def make_grid_lines(self):
def make_clearspace_lines(self):
recommended_annotation = self.annotations.make_annotation(text="RECOMMENDED")
minimal_annotation = self.annotations.make_annotation(text="MINIMAL")
if self.show_icon_clearspace:
icon_annotation = self.annotations.make_annotation(text="ICON")
return (
svg.Rect(
x=self.recommended.canvas.min_x,
y=self.recommended.canvas.min_y,
width=100,
height=100,
fill="red",
stroke=5,
),
svg.Rect(
x=self.recommended.canvas.min_x,
y=self.recommended.canvas.min_y,
Expand Down
1 change: 1 addition & 0 deletions package-sets/python-packages/nixoslogo/nixoslogo/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ class ClearSpace(Enum):
NONE = auto()
MINIMAL = auto()
RECOMMENDED = auto()
ICON = auto()


class ColorStyle(Enum):
Expand Down
2 changes: 1 addition & 1 deletion package-sets/python-packages/nixoslogo/nixoslogo/logo.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def __init__(
logotype_cap_height: float | None = None,
logotype_color: str = "black",
logotype_style: LogotypeStyle = LogotypeStyle.REGULAR,
logotype_spacings: tuple[int] = DEFAULT_LOGOTYPE_SPACINGS_WITH_BEARING,
logotype_spacings: tuple[int, ...] = DEFAULT_LOGOTYPE_SPACINGS_WITH_BEARING,
logotype_characters: str = "NixOS",
logotype_transform: svg.Translate | None = None,
clear_space: ClearSpace = ClearSpace.RECOMMENDED,
Expand Down
4 changes: 4 additions & 0 deletions package-sets/python-packages/nixoslogo/nixoslogo/logomark.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ def _get_clearspace(self):
return self.elements_y_max / 2
case ClearSpace.RECOMMENDED:
return self.elements_y_max
case ClearSpace.ICON:
return self.elements_y_max / 8
case _:
raise Exception(f"Unknown ClearSpace: {self.clear_space}")

Expand Down Expand Up @@ -216,6 +218,8 @@ def _get_clearspace(self):
return self.elements_y_max / 2
case ClearSpace.RECOMMENDED:
return self.elements_y_max
case ClearSpace.ICON:
return self.elements_y_max / 8
case _:
raise Exception(f"Unknown ClearSpace: {self.clear_space}")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ artifact-builder }:
artifact-builder {
name = "nixos-logo-clearspace";
outputHash = "sha256-2KzUQsyjcwfAH2fqUQrSZmJBSO0sMzC32lvptFSyVOw=";
outputHash = "sha256-v5pCaAEZEMxUobBl9ekTHlJDREBhPPZzb2KdWyrWXJM=";
script = ./script.py;
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ artifact-builder }:
artifact-builder {
name = "nixos-logomark-clearspace";
outputHash = "sha256-f2LSFFGeJlkrhFHNN/2drhQr7mzlQ9VMBaXPk89P3p8=";
outputHash = "sha256-YQtKddyhfASO7wNNFtbiPw5YEd2kikybI0L5Fn/ZYkQ=";
script = ./script.py;
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
logo_name="logomark",
space_object=space_object,
annotations=annotations,
show_icon_clearspace=True,
)
ilc.write_svg()
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{ artifact-builder }:
artifact-builder {
name = "nixos-logotype-clearspace";
outputHash = "sha256-MKaFYf9/lxTWTdr2OfOMZU4CqtbAE/KmozY20xfPeXo=";
outputHash = "sha256-lPdN/5gvxUpsHpJCkC1ilR8wTj5K45aBE4qM4hhVDfo=";
script = ./script.py;
}
Loading