Compare commits

..

31 Commits

Author SHA1 Message Date
Azalea (on HyDEV-Daisy) 92623417f9 [U] Release 1.1.2 2022-07-25 21:24:43 -04:00
Azalea (on HyDEV-Daisy) 47e8a4b6ae Merge branch 'master' of https://github.com/hykilpikonna/neofetch 2022-07-25 21:21:25 -04:00
Azalea (on HyDEV-Daisy) ce787650ff [F] Remove numpy requirement 2022-07-25 21:21:19 -04:00
Hykilpikonna f38da1da7b [U] Readme: Add nixos demo 2022-07-25 21:16:24 -04:00
Hykilpikonna aa2a46c307 [U] Update todo & future changelog 2022-07-25 21:11:34 -04:00
Hykilpikonna 249d88968a [PR] #5 larobitrumpet/master - Add more flags
Add Various Pride Flags
2022-07-25 21:07:24 -04:00
Azalea (on HyDEV-Daisy) 47ad86c1b3 Merge branch 'master' of https://github.com/hykilpikonna/neofetch 2022-07-25 21:06:31 -04:00
Azalea (on HyDEV-Daisy) 3358918a96 [U] Release v1.1.1 2022-07-25 21:06:27 -04:00
Hykilpikonna d210e8b717 [U] Changelog 2022-07-25 21:05:33 -04:00
Azalea (on HyDEV-Daisy) 2a0e05e228 [+] Create color scale without numpy 2022-07-25 21:02:10 -04:00
Hykilpikonna f80262b615 [PR] #4 YisuiDenghua/patch-1 Add NixOS instructions
Update README.md
2022-07-25 20:51:37 -04:00
Hykilpikonna 7aa46cb623 Merge branch 'master' into patch-1 2022-07-25 20:51:13 -04:00
Hykilpikonna 2a4242c57a [PR] #3 emixa-d/master - Add Guix installation instructions
Add Guix installation instructions
2022-07-25 20:48:29 -04:00
Azalea (on HyDEV-Daisy) 8d3a3cc7f0 [F] Fix config upgrade error 2022-07-25 20:43:52 -04:00
Lucy Robillard bee34b6262 Fix bigender flag 2022-07-25 12:59:23 -07:00
Lucy Robillard f4b91ddb9a Add bigender flag 2022-07-25 12:54:48 -07:00
Lucy Robillard 348c6d4dcc Add omnisexual flag 2022-07-25 12:43:55 -07:00
Lucy Robillard d9a46c97c8 Add abrosexual flag 2022-07-25 12:38:50 -07:00
Lucy Robillard 06d299f2f7 Add 5 stripe gay men flag 2022-07-20 12:51:04 -07:00
Lucy Robillard cd0f55cd92 Add polysexual 2022-07-20 12:37:10 -07:00
Lucy Robillard 5f31542362 Add demigender, demiboy, and demigirl 2022-07-20 12:27:40 -07:00
Lucy Robillard edd5d39f73 Add genderfae and demifae 2022-07-20 12:13:11 -07:00
Lucy Robillard 73bf1e7fdf Add genderfaun flag 2022-07-20 11:04:51 -07:00
Lucy Robillard a511742239 Add transfeminine flag 2022-07-20 10:56:09 -07:00
Lucy Robillard abed2f36e0 Add 3 versions of the aroace flag 2022-07-20 10:40:44 -07:00
Milena - 一穗灯花 7682408554 Update README.md 2022-06-30 17:03:21 +08:00
Milena - 一穗灯花 9e85fbc151 修正了语法错误 2022-06-30 17:01:34 +08:00
Milena - 一穗灯花 10408af1a2 修正了语法错误 2022-06-30 16:59:44 +08:00
Milena - 一穗灯花 23814863f1 Update README.md 2022-06-30 16:58:12 +08:00
Milena - 一穗灯花 8d65521fad Update README.md 2022-06-30 16:54:44 +08:00
Maxime Devos 707eac5087 [U] guix: Update readme usage 2022-05-12 13:24:14 +00:00
7 changed files with 293 additions and 28 deletions
+31 -4
View File
@@ -19,10 +19,21 @@ pip install hyfetch
Currently, these distributions have existing packages for HyFetch:
* ArchLinux: `yay -S hyfetch` (Thanks to @ Aleksana)
* NixOS: `nix-env -i hyfetch` ([In Progress](https://github.com/NixOS/nixpkgs/pull/170309))
* Guix: [In progress](https://issues.guix.gnu.org/54847#8-lineno27)
* Nix (Nixpkgs): `nix-env -i hyfetch` ([In Progress](https://github.com/NixOS/nixpkgs/pull/170309))
* Nix (NUR): ([In Progress](https://github.com/nix-community/NUR/pull/467))
* Guix: `guix install hyfetch` (Thanks to @ WammKD)
Currently, if you're using NixOS, you can use HyFetch with `nix-env -if https://github.com/hykilpikonna/hyfetch/tarball/master -A hyfetch`
Currently, if you're using Nix the package manager or NixOS, you can use HyFetch with `nix-env -if https://github.com/hykilpikonna/hyfetch/tarball/master -A hyfetch`
> Now `hyfetch` is available in our NixOS-CN's flake. You can add [NixOS-CN](https://github.com/nixos-cn/flakes) in your [Nix Flake](https://nixos.org/manual/nix/unstable/command-ref/new-cli/nix3-flake.html) at first, then install package `hyfetch`.
> ```
> #flake.nix
>
> environment.systemPackages =
> [ nixos-cn.legacyPackages.${system}.hyfetch ];
>
> ```
> (Thanks to @ YisuiDenghua and @ linyinfeng )
## Usage
@@ -48,8 +59,24 @@ Feel free to experiment with it!
### TODO
* [ ] Add interactive configurator for adjusting brightness
* [ ] Add configuration to emphasize certain parts of the original ASCII art (to make icons like Fedora and Ubuntu look nicer)
* [ ] Paginate flags
### 1.1.2
* Add more flags ([#5](https://github.com/hykilpikonna/hyfetch/pull/5))
* Removed `numpy` dependency that was used in 1.1.0
### 1.1.0
* Refactored a lot of things
* Added Beiyang flag xD
* Added interactive configurator for brightness adjustment
* Added dark/light mode selection
* Added color bar preview for RGB/8bit mode selection
* Added random color arrangement feature (for NixOS)
<img src="https://user-images.githubusercontent.com/22280294/180901539-014f036e-c926-4470-ac72-a6d6dcf30672.png" width="100px" />
### 1.0.7
+26 -21
View File
@@ -1,66 +1,71 @@
"""
This version of color_scale is a special version made without numpy dependency. The numpy version
would be faster, but numpy is 11 MB large. In comparison, hyfetch 1.0.7 is only 105 kB, so it's not
a good idea to depend on numpy.
"""
from __future__ import annotations
import numpy as np
from numpy import ndarray
from .color_util import RGB
def create_gradient_hex(colors: list[str], resolution: int = 300) -> ndarray:
def create_gradient_hex(colors: list[str], resolution: int = 300) -> list[RGB]:
"""
Create gradient array from hex
"""
colors = np.array([RGB.from_hex(s) for s in colors])
colors = [RGB.from_hex(s) for s in colors]
return create_gradient(colors, resolution)
def create_gradient(colors: ndarray, resolution: int) -> ndarray:
def create_gradient(colors: list[RGB], resolution: int) -> list[RGB]:
"""
Create gradient 2d array.
Create gradient array
Usage: arr[ratio / len(arr), :] = Scaled gradient color at that point
Usage: arr[ratio / len(arr)] = Scaled gradient color at that point
"""
result = np.zeros((resolution * (len(colors) - 1), 3), dtype='uint8')
result = []
# Create gradient mapping
for i in range(len(colors) - 1):
c1 = colors[i, :]
c2 = colors[i + 1, :]
c1 = colors[i]
c2 = colors[i + 1]
bi = i * resolution
for r in range(resolution):
ratio = r / resolution
result[bi + r, :] = c2 * ratio + c1 * (1 - ratio)
for ri in range(resolution):
ratio = ri / resolution
r = int(c2.r * ratio + c1.r * (1 - ratio))
g = int(c2.g * ratio + c1.g * (1 - ratio))
b = int(c2.b * ratio + c1.b * (1 - ratio))
result.append(RGB(r, g, b))
return result
def get_raw(gradient: ndarray, ratio: float) -> ndarray:
def get_raw(gradient: list[RGB], ratio: float) -> RGB:
"""
:param gradient: Gradient array (2d)
:param ratio: Between 0-1
:return: RGB subarray (1d, has 3 values)
"""
if ratio == 1:
return gradient[-1, :]
return gradient[-1]
i = int(ratio * len(gradient))
return gradient[i, :]
return gradient[i]
class Scale:
colors: ndarray
rgb: ndarray
colors: list[RGB]
rgb: list[RGB]
def __init__(self, scale: list[str], resolution: int = 300):
self.colors = np.array([RGB.from_hex(s) for s in scale])
self.colors = [RGB.from_hex(s) for s in scale]
self.rgb = create_gradient(self.colors, resolution)
def __call__(self, ratio: float) -> RGB:
"""
:param ratio: Between 0-1
"""
return RGB(*get_raw(self.rgb, ratio))
return get_raw(self.rgb, ratio)
def test_color_scale():
+71
View File
@@ -0,0 +1,71 @@
from __future__ import annotations
import numpy as np
from numpy import ndarray
from .color_util import RGB
def create_gradient_hex(colors: list[str], resolution: int = 300) -> ndarray:
"""
Create gradient array from hex
"""
colors = np.array([RGB.from_hex(s) for s in colors])
return create_gradient(colors, resolution)
def create_gradient(colors: ndarray, resolution: int) -> ndarray:
"""
Create gradient 2d array.
Usage: arr[ratio / len(arr), :] = Scaled gradient color at that point
"""
result = np.zeros((resolution * (len(colors) - 1), 3), dtype='uint8')
# Create gradient mapping
for i in range(len(colors) - 1):
c1 = colors[i, :]
c2 = colors[i + 1, :]
bi = i * resolution
for r in range(resolution):
ratio = r / resolution
result[bi + r, :] = c2 * ratio + c1 * (1 - ratio)
return result
def get_raw(gradient: ndarray, ratio: float) -> ndarray:
"""
:param gradient: Gradient array (2d)
:param ratio: Between 0-1
:return: RGB subarray (1d, has 3 values)
"""
if ratio == 1:
return gradient[-1, :]
i = int(ratio * len(gradient))
return gradient[i, :]
class Scale:
colors: ndarray
rgb: ndarray
def __init__(self, scale: list[str], resolution: int = 300):
self.colors = np.array([RGB.from_hex(s) for s in scale])
self.rgb = create_gradient(self.colors, resolution)
def __call__(self, ratio: float) -> RGB:
"""
:param ratio: Between 0-1
"""
return RGB(*get_raw(self.rgb, ratio))
def test_color_scale():
scale = Scale(['#232323', '#4F1879', '#B43A78', '#F98766', '#FCFAC0'])
colors = 100
for i in range(colors + 1):
print(scale(i / colors).to_ansi_rgb(False), end=' ')
+1 -1
View File
@@ -7,7 +7,7 @@ from pathlib import Path
from typing_extensions import Literal
CONFIG_PATH = Path.home() / '.config/hyfetch.json'
VERSION = '1.1.0'
VERSION = '1.1.2'
# Obtain terminal size
try:
+4 -1
View File
@@ -27,7 +27,10 @@ def check_config() -> Config:
:return: Config object
"""
if CONFIG_PATH.is_file():
return Config.from_dict(json.loads(CONFIG_PATH.read_text('utf-8')))
try:
return Config.from_dict(json.loads(CONFIG_PATH.read_text('utf-8')))
except KeyError:
return create_config()
return create_config()
+159
View File
@@ -201,6 +201,30 @@ PRESETS: dict[str, ColorProfile] = {
'#1AB3FF'
]),
'polysexual': ColorProfile([
'#F714BA',
'#01D66A',
'#1594F6',
]),
# omnisexual sorced from https://www.flagcolorcodes.com/omnisexual
'omnisexual': ColorProfile([
'#FE9ACE',
'#FF53BF',
'#200044',
'#6760FE',
'#8EA6FF',
]),
# gay men sourced from https://www.flagcolorcodes.com/gay-men
'gay-men': ColorProfile([
'#078D70',
'#98E8C1',
'#FFFFFF',
'#7BADE2',
'#3D1A78'
]),
'lesbian': ColorProfile([
'#D62800',
'#FF9B56',
@@ -209,6 +233,16 @@ PRESETS: dict[str, ColorProfile] = {
'#A40062'
]),
# abrosexual used colorpicker to source from
# https://fyeahaltpride.tumblr.com/post/151704251345/could-you-guys-possibly-make-an-abrosexual-pride
'abrosexual': ColorProfile([
'#46D294',
'#A3E9CA',
'#FFFFFF',
'#F78BB3',
'#EE1766',
]),
'asexual': ColorProfile([
'#000000',
'#A4A4A4',
@@ -224,6 +258,35 @@ PRESETS: dict[str, ColorProfile] = {
'#000000'
]),
# aroace1 sourced from https://flag.library.lgbt/flags/aroace/
'aroace1': ColorProfile([
'#E28C00',
'#ECCD00',
'#FFFFFF',
'#62AEDC',
'#203856'
]),
'aroace2': ColorProfile([
'#000000',
'#810081',
'#A4A4A4',
'#FFFFFF',
'#A8D47A',
'#3BA740'
]),
'aroace3': ColorProfile([
'#3BA740',
'#A8D47A',
'#FFFFFF',
'#ABABAB',
'#000000',
'#A4A4A4',
'#FFFFFF',
'#810081'
]),
# below sourced from https://www.flagcolorcodes.com/flags/pride
# goto f"https://www.flagcolorcodes.com/{preset}" for info
# todo: sane sorting
@@ -260,6 +323,51 @@ PRESETS: dict[str, ColorProfile] = {
'#000000',
]),
# bigender sourced from https://www.flagcolorcodes.com/bigender
'bigender': ColorProfile([
'#C479A2',
'#EDA5CD',
'#D6C7E8',
'#FFFFFF',
'#D6C7E8',
'#9AC7E8',
'#6D82D1',
]),
# demigender yellow sourced from https://lgbtqia.fandom.com/f/p/4400000000000041031
# other colors sourced from demiboy and demigirl flags
'demigender': ColorProfile([
'#7F7F7F',
'#C4C4C4',
'#FBFF75',
'#FFFFFF',
'#FBFF75',
'#C4C4C4',
'#7F7F7F',
]),
# demiboy sourced from https://www.flagcolorcodes.com/demiboy
'demiboy': ColorProfile([
'#7F7F7F',
'#C4C4C4',
'#9DD7EA',
'#FFFFFF',
'#9DD7EA',
'#C4C4C4',
'#7F7F7F',
]),
# demigirl sourced from https://www.flagcolorcodes.com/demigirl
'demigirl': ColorProfile([
'#7F7F7F',
'#C4C4C4',
'#FDADC8',
'#FFFFFF',
'#FDADC8',
'#C4C4C4',
'#7F7F7F',
]),
'transmasculine': ColorProfile([
'#FF8ABD',
'#CDF5FE',
@@ -270,6 +378,29 @@ PRESETS: dict[str, ColorProfile] = {
'#FF8ABD',
]),
# transfeminine used colorpicker to source from https://www.deviantart.com/pride-flags/art/Trans-Woman-Transfeminine-1-543925985
# linked from https://gender.fandom.com/wiki/Transfeminine
'transfeminine': ColorProfile([
'#73DEFF',
'#FFE2EE',
'#FFB5D6',
'#FF8DC0',
'#FFB5D6',
'#FFE2EE',
'#73DEFF',
]),
# genderfaun sourced from https://www.flagcolorcodes.com/genderfaun
'genderfaun': ColorProfile([
'#FCD689',
'#FFF09B',
'#FAF9CD',
'#FFFFFF',
'#8EDED9',
'#8CACDE',
'#9782EC',
]),
'demifaun': ColorProfile([
'#7F7F7F',
'#7F7F7F',
@@ -286,6 +417,34 @@ PRESETS: dict[str, ColorProfile] = {
'#7F7F7F',
]),
# genderfae sourced from https://www.flagcolorcodes.com/genderfae
'genderfae': ColorProfile([
'#97C3A5',
'#C3DEAE',
'#F9FACD',
'#FFFFFF',
'#FCA2C4',
'#DB8AE4',
'#A97EDD',
]),
# demifae used colorpicker to source form https://www.deviantart.com/pride-flags/art/Demifae-870194777
'demifae': ColorProfile([
'#7F7F7F',
'#7F7F7F',
'#C5C5C5',
'#C5C5C5',
'#97C3A4',
'#C4DEAE',
'#FFFFFF',
'#FCA2C5',
'#AB7EDF',
'#C5C5C5',
'#C5C5C5',
'#7F7F7F',
'#7F7F7F',
]),
'neutrois': ColorProfile([
'#FFFFFF',
'#1F9F00',
+1 -1
View File
@@ -32,7 +32,7 @@ setup(
packages=['hyfetch'],
package_data={'hyfetch': ['hyfetch/*']},
include_package_data=True,
install_requires=['setuptools', 'typing_extensions', 'numpy'],
install_requires=['setuptools', 'typing_extensions'],
entry_points={
"console_scripts": [
"hyfetch=hyfetch.main:run",