Coder Social home page Coder Social logo

rajasegar / alacritty-themes Goto Github PK

View Code? Open in Web Editor NEW
685.0 7.0 70.0 1.77 MB

:rainbow: :lollipop: Themes :candy: :heart_eyes: for Alacritty: A cross-platform GPU-accelerated Terminal emulator

License: MIT License

JavaScript 100.00%
alacritty alacritty-theme alacritty-colorscheme cli

alacritty-themes's Introduction

Hi there 👋 I am Rajasegar

I am a Frontend Architect passionate about Open source and building some cool stuff for the web.

Rajasegar's github stats

alacritty-themes's People

Contributors

aisayo avatar christopherdolan avatar comonadd avatar danilo-alm avatar davemenninger avatar dependabot[bot] avatar dmitryromanov avatar eldios avatar fumihumi avatar helmerdavila avatar itsprakashp avatar juanvqz avatar mesalilac avatar nilsmartel avatar nxvxl avatar otavionetoca avatar paulo-santana avatar polsust avatar rajasegar avatar rashil2000 avatar s6muel avatar sajoku avatar schmeekygeek avatar semantic-release-bot avatar stephanospavlou avatar tiagaoalb avatar z00rat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

alacritty-themes's Issues

Too many backups

Describe the bug

Looks like every time it runs, it creates a backup file for some reason. Was wondering if that is necessary or is it a bug?

To Reproduce

Steps to reproduce the behavior:

  1. Installation
  • I run it via npx alacritty-themes
  • I installed it via npm i -g alacritty-themes (global installation)
  1. Run alacritty-themes
  • Did you add params? yes, I type "alacritty-themes Ayu-Dark"
  • Did you add params? no, I just type "alacritty-themes" then click up/down keys
  1. See error

Expected behavior

Just run normally without creating multiple backup files

Operating System:

  • Windows
  • Ubuntu
  • Pop Os
  • Arch
  • Other, which one?

Add your alacritty.yml content

font:
  size: 14
  normal:
    family: Fira Code Medium
    # in terminal of angela
    # family: Monaco
    # family: Cousine
    style: Regular
  offset:
    x: 0
    y: 5
shell:
  program: /bin/zsh
traw_bold_text_with_bright_colors: false
window:
  # requires compositor running
  opacity: 1
  padding:
    x: 10
    y: 10
cursor:
  style:
    shape: Beam
    blinking: On
import:
  - ~/.config/alacritty/themes/challenger-deep.yml
colors:
  name: 3024 (dark)
  author: Chris Kempson
  primary:
    background: "#090300"
    foreground: "#a5a2a2"
  cursor:
    text: "#090300"
    cursor: "#a5a2a2"
  normal:
    black: "#090300"
    red: "#db2d20"
    green: "#01a252"
    yellow: "#fded02"
    blue: "#01a0e4"
    magenta: "#a16a94"
    cyan: "#b5e4f4"
    white: "#a5a2a2"
  bright:
    black: "#5c5855"
    red: "#db2d20"
    green: "#01a252"
    yellow: "#fded02"
    blue: "#01a0e4"
    magenta: "#a16a94"
    cyan: "#b5e4f4"
    white: "#f7f7f7"
theme: 3024.dark

Screenshots

alacritty-themes

App breaks if you type a string that doesn't match a theme

If you start typing to search a theme and mistype a character by accident, the app will throw an uncaught error where it says it didn't find a file with the name undefined.yml. Altough this is not critical, it's a bit of an annoyance having to run the command again and to wait for npx to do it's thing.

How to reproduce: just run npx alacritty-themes and type nonsense.

If I may suggest a fix for this, I'd say that we should either handle the thrown exception, or, more preferably, do not procceed to set the theme if the result of the search is undefined.

Suggestion: allow use of PgUp and PgDown scrolling (among other suggestions)

So, like the title says. Here are some suggestions I think that would streamline the theme selector.

  1. Allow use of PgUp and PgDown for scrolling (this goes faster than using arrow up and down one at a time).
  2. Theme previews (hovering over a theme shows a preview of what it will look like, either by temporarily themeing Alacritty or something)

I'm not sure how possible this is with npm/node.

Add an accompanying generated comment for better identification

Is your feature request related to a problem? Please describe.

The way I see it, Alacritty encourages its users to fiddle around and manage its configuration by editing the Alacritty config file as they see fit. And alacritty-themes is essentially a yaml file patcher, patching the correct "colors" dictionary in the Alacritty config file, as per the user's input.

As of today, there is no way for users to notice and remember that these modifications was made automatically for them by a tool. They may not remember later if they had copy/pasted the colors manually or how it was updated.

Describe the solution you'd like

Leaving a comment may remind the user that they have the option to use alacritty-themes again to change the theme, without manually needed to make the edits.

I would say it is generally a good etiquette for a bot/program to communicate and let humans know that it made the edit. This way users are comfortably aware that they are not the only one editing the config file. As a side-effect, the comment can be used to provide additional instructions and so on for the user. It also looks cleaner & structured.

before
Screen Shot 2021-10-31 at 3 09 38 PM

after
Screen Shot 2021-10-31 at 3 12 16 PM

Don't have much opinion on the comment message. Change it accordingly.

Describe alternatives you've considered

Alternative would be to not add any yaml comments. If there is a good reason not do add any, would certainly like to know. But then the problem remains that one cannot tell just by looking at the Alacritty config file, who made the color edits.

Additional context
There is no apparent harm if the user deletes the comment, or modifies it. alacritty-themes can choose to gracefully handle that situation. But then again, I would argue most users will not mind an auto-generated comment and would leave it as is.
Goes without saying that alacritty-themes should not duplicate the comment. That would be terrible.

TypeError: path.existsSync is not a function

Solved by #18

It was a wrong call to path rather than fs

/Users/myuser/.nvm/versions/node/v14.15.4/lib/node_modules/alacritty-themes/index.js:10
      if (path.existsSync(configPath)) return configPath;
               ^

TypeError: path.existsSync is not a function
    at findExistingFile (/Users/myuser/.nvm/versions/node/v14.15.4/lib/node_modules/alacritty-themes/index.js:10:16)
    at getAlacrittyConfig (/Users/myuser/.nvm/versions/node/v14.15.4/lib/node_modules/alacritty-themes/index.js:42:10)
    at Object.<anonymous> (/Users/myuser/.nvm/versions/node/v14.15.4/lib/node_modules/alacritty-themes/index.js:46:17)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/myuser/.nvm/versions/node/v14.15.4/lib/node_modules/alacritty-themes/bin/cli.js:8:51)

ERR_INVALID_ARG_TYPE on attempting to start

Describe the bug

After fresh installing both npm and alacritty-themes, I get the following error when attempting to run the alacritty-themes command

PS C:\> alacritty-themes
node:internal/validators:119
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:371:5)
    at validateString (node:internal/validators:119:11)
    at Object.join (node:path:429:7)
    at possibleLocations (C:\Users\[redacted]\AppData\Roaming\npm\node_modules\alacritty-themes\src\helpers\index.js:74:10)
    at Object.<anonymous> (C:\Users\[redacted]\AppData\Roaming\npm\node_modules\alacritty-themes\src\helpers\index.js:7:5)
    at Module._compile (node:internal/modules/cjs/loader:1095:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1147:10)
    at Module.load (node:internal/modules/cjs/loader:975:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:999:19) {
  code: 'ERR_INVALID_ARG_TYPE'
}

Node.js v17.0.1

Steps to reproduce the behavior: simply attempt to run alacritty-themes

  1. Installation

I installed it via npm i -g alacritty-themes (global installation)

  1. Run alacritty-themes
  • [ x ] Did you add params? yes, I type "alacritty-themes Ayu-Dark"
  • [ x ] Did you add params? no, I just type "alacritty-themes" then click up/down keys

Neither works, same error.

Operative System:

Windows 10 Home 19043.1348

Cannot read property 'items' of null

node_modules/alacritty-themes/index.js:39
const colors = doc.contents.items.filter((i) => i.key.value === 'colors')[0];

TypeError: Cannot read property 'items' of null
at updateTheme (/usr/lib/node_modules/alacritty-themes/index.js:39:31)
at /usr/lib/node_modules/alacritty-themes/index.js:68:5
at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:75:3)

UTF-8 bugs

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

Steps to reproduce the behavior:

  1. Installation
  • [ X] I run it via npx alacritty-themes
  • [ X] I installed it via npm i -g alacritty-themes (global installation)
  1. Run alacritty-themes
  • [ X] Did you add params? yes, I type "alacritty-themes Ayu-Dark"
  • [ X] Did you add params? no, I just tipe "alacritty-themes" then click up/down keys
  1. See error

Expected behavior

A clear and concise description of what you expected to happen.

Operative System:

  • Windows
  • Ubuntu
  • Pop Os
  • [X ] Arch
  • Other, which one?

Add your alacritty.yml content

# Configuration for Alacritty, the GPU enhanced terminal emulator.

# Any items in the `env` entry below will be added as
# environment variables. Some entries may override variables
# set by alacritty itself.
env:
  # TERM variable
  #
  # This value is used to set the `$TERM` environment variable for
  # each instance of Alacritty. If it is not present, alacritty will
  # check the local terminfo database and use `alacritty` if it is
  # available, otherwise `xterm-256color` is used.
  TERM: alacritty
  LANG: "en_US.UTF-8"
  LC_CTYPE: en_US.UTF-8
  #window:
  # Window dimensions (changes require restart)
  #
  # Specified in number of columns/lines, not pixels.
  # If both are `0`, this setting is ignored.
  #dimensions:
  #  columns: 0
  #  lines: 0
  # Window position (changes require restart)
  #
  # Specified in number of pixels.
  # If the position is not set, the window manager will handle the placement.
  #position:
  #  x: 0
  #  y: 0
  # Window padding (changes require restart)
  #
  # Blank space added around the window in pixels. This padding is scaled
  # by DPI and the specified value is always added at both opposing sides.
  #padding:
  #  x: 0
  #  y: 0
  # Spread additional padding evenly around the terminal content.
  #dynamic_padding: false
  # Window decorations
  #
  # Values for `decorations`:
  #     - full: Borders and title bar
  #     - none: Neither borders nor title bar
  #
  # Values for `decorations` (macOS only):
  #     - transparent: Title bar, transparent background and title bar buttons
  #     - buttonless: Title bar, transparent background, but no title bar buttons
  #decorations: full
  # Startup Mode (changes require restart)
  #
  # Values for `startup_mode`:
  #   - Windowed
  #   - Maximized
  #   - Fullscreen
  #
  # Values for `startup_mode` (macOS only):
  #   - SimpleFullscreen
  #startup_mode: Windowed
  # Window title
  #title: Alacritty
  # Window class (Linux/BSD only):
  #class:
  # Application instance name
  #instance: Alacritty
  # General application class
  #general: Alacritty
  # GTK theme variant (Linux/BSD only)
  #
  # Override the variant of the GTK theme. Commonly supported values are `dark` and `light`.
  # Set this to `None` to use the default theme variant.
  #gtk_theme_variant: None
  #scrolling:
  # Maximum number of lines in the scrollback buffer.
  # Specifying '0' will disable scrolling.
  #history: 10000
  # Number of lines the viewport will move for every line scrolled when
  # scrollback is enabled (history > 0).
  #multiplier: 3

# Font configuration
font:
  # Normal (roman) font face
  normal:
    # Font family
    #
    # Default:
    #   - (macOS) Menlo
    #   - (Linux/BSD) monospace
    #   - (Windows) Consolas
    family: "monospace"

    # The `style` can be specified to pick a specific face.
    style: Regular
    # Bold font face
    #bold:
    # Font family
    #
    # If the bold family is not specified, it will fall back to the
    # value specified for the normal font.
    #family: monospace
    # The `style` can be specified to pick a specific face.
    #style: Bold
    # Italic font face
    #italic:
    # Font family
    #
    # If the italic family is not specified, it will fall back to the
    # value specified for the normal font.
    #family: monospace
    # The `style` can be specified to pick a specific face.
    #style: Italic
    # Bold italic font face
    #bold_italic:
    # Font family
    #
    # If the bold italic family is not specified, it will fall back to the
    # value specified for the normal font.
    #family: monospace
    # The `style` can be specified to pick a specific face.
    #style: Bold Italic

  # Point size
  size: 11.0

  # Offset is the extra space around each character. `offset.y` can be thought of
  # as modifying the line spacing, and `offset.x` as modifying the letter spacing.
  #offset:
  #  x: 0
  #  y: 0
  # Glyph offset determines the locations of the glyphs within their cells with
  # the default being at the bottom. Increasing `x` moves the glyph to the right,
  # increasing `y` moves the glyph upwards.
  #glyph_offset:
  #  x: 0
  #  y: 0
  # Thin stroke font rendering (macOS only)
  #
  # Thin strokes are suitable for retina displays, but for non-retina screens
  # it is recommended to set `use_thin_strokes` to `false`
  #
  # macOS >= 10.14.x:
  #
  # If the font quality on non-retina display looks bad then set
  # `use_thin_strokes` to `true` and enable font smoothing by running the
  # following command:
  #   `defaults write -g CGFontRenderingFontSmoothingDisabled -bool NO`
  #
  # This is a global setting and will require a log out or restart to take
  # effect.
  use_thin_strokes: true

# If `true`, bold text is drawn using the bright color variants.
#draw_bold_text_with_bright_colors: false
# Colors (Tomorrow Night Bright)
colors:
  # Default colors
  primary:
    background: '#002b36' # base03
    foreground: '#839496' # base0

  # Cursor colors
  cursor:
    text: '#002b36' # base03
    cursor: '#839496' # base0

  # Normal colors
  normal:
    black: '#073642' # base02
    red: '#dc322f' # red
    green: '#859900' # green
    yellow: '#b58900' # yellow
    blue: '#268bd2' # blue
    magenta: '#d33682' # magenta
    cyan: '#2aa198' # cyan
    white: '#eee8d5' # base2

  # Bright colors
  bright:
    black: '#002b36' # base03
    red: '#cb4b16' # orange
    green: '#586e75' # base01
    yellow: '#657b83' # base00
    blue: '#839496' # base0
    magenta: '#6c71c4' # violet
    cyan: '#93a1a1' # base1
    white: '#fdf6e3' # base3
theme: Solarized-Dark

Screenshots

image
Add screenshots to help explain your problem.

Yup, UTF-8 bug with accentts when i set theme

It crashes after selecting a theme

I did a fresh install via npm i -g alacritty-themes, but after selecting a theme it just crashes. Output:

$  alacritty-themes
? Select a theme: Argonaut
/home/till/.node_modules/lib/node_modules/alacritty-themes/index.js:24
  colors.value = themeColors.value;
               ^

TypeError: Cannot set property 'value' of undefined
    at updateTheme (/home/till/.node_modules/lib/node_modules/alacritty-themes/index.js:24:16)
    at /home/till/.node_modules/lib/node_modules/alacritty-themes/index.js:64:7
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)

Themes still use deprecated background_opacity field.

Describe the bug

Any terminal instances I open have a big yellow warning message at the bottom saying

Config warning: background_opacity is deprecated; use window.opacity instead

I could go to my ~/.config/alacritty/alacritty.yml and manually change the field, but it will revert everytime I run alacritty-themes to switch to another theme.

To Reproduce

  1. Installation
    yay -s alacritty-themes

  2. Run alacritty-themes

Operative System:

Arch, Linux 5.15.19-1-lts

An example of a theme .yml file that alacritty-themes writes to ~/config/alacritty/alacritty.yml

colors:
  name: Atelierheath (dark)
  author: Chris Kempson
  primary:
    background: "#1b181b"
    foreground: "#ab9bab"
  cursor:
    text: "#1b181b"
    cursor: "#ab9bab"
  normal:
    black: "#1b181b"
    red: "#ca402b"
    green: "#379a37"
    yellow: "#bb8a35"
    blue: "#516aec"
    magenta: "#7b59c0"
    cyan: "#159393"
    white: "#ab9bab"
  bright:
    black: "#776977"
    red: "#ca402b"
    green: "#379a37"
    yellow: "#bb8a35"
    blue: "#516aec"
    magenta: "#7b59c0"
    cyan: "#159393"
    white: "#f7f3f7"

background_opacity: 0.8
theme: Atelierheath.dark
me: Default.light

Screenshots

Add screenshots to help explain your problem.
image

Error after pressing control + c

Describe the bug

A clear and concise description of what the bug is.

To Reproduce

pressed control c in terminal

  1. Installation
  • I run it via npx alacritty-themes
  • I installed it via npm i -g alacritty-themes (global installation)
  1. Run alacritty-themes
  • Did you add params? yes, I type "alacritty-themes Ayu-Dark"
  • Did you add params? no, I just type "alacritty-themes" then click up/down keys
  1. See error

Expected behavior

A clear and concise description of what you expected to happen.

Somehow broke it pressing control + c. I get this error:
backup file was created: /home/brett/.config/alacritty/alacritty.yml.1683059351612.bak
/usr/local/lib/node_modules/alacritty-themes/node_modules/yaml/dist/Document-9b4560a1.js:676
if (this.errors.length > 0) throw new Error('Document with errors cannot be stringified');
^

Error: Document with errors cannot be stringified
at Document.toString (/usr/local/lib/node_modules/alacritty-themes/node_modules/yaml/dist/Document-9b4560a1.js:676:39)
at String ()
at updateThemeWithFile (/usr/local/lib/node_modules/alacritty-themes/index.js:98:22)
at updateTheme (/usr/local/lib/node_modules/alacritty-themes/index.js:117:10)
at /usr/local/lib/node_modules/alacritty-themes/index.js:124:12

Operating System:

  • Windows
  • Ubuntu
  • Pop Os
  • Arch
  • Fedora KDE 36

Add your alacritty.yml content

# your alacritty content here
![error](https://user-images.githubusercontent.com/63263447/235779633-0bd1f7af-8957-4eaf-8d34-cf68ad990997.png)

Screenshots

Add screenshots to help explain your problem.

Using alacritty-themes deindent commented out sections in the default yaml file

Trying out alacritty for the first time, and came across this; also first time configuring anything with YAML.

When alacritty-themes is run to change the configuration yaml-file, it deindents commented lines in the default alacritty.yaml you can get from here.

Example configuration:

# Font configuration
#font:
  # Normal (roman) font face
  #normal:
    # Font family
    #
    # Default:
    #   - (macOS) Menlo
    #   - (Linux/BSD) monospace
    #   - (Windows) Consolas
    #family: monospace

    # The `style` can be specified to pick a specific face.
    #style: Regular

is turned into:

# Font configuration
#font:
# Normal (roman) font face
#normal:
# Font family
#
# Default:
#   - (macOS) Menlo
#   - (Linux/BSD) monospace
#   - (Windows) Consolas
#family: monospace
# The `style` can be specified to pick a specific face.
#style: Regular

The comments are indented before the #, so apparently whatever yaml-parser is being used by alacritty-themes removes the "superfluous" white-space before it, breaking the formatting of the commented example yaml-sections and breaking the configuration without apparent cause.

I'm not sure where the issue really should be put, alacritty project (the comment indenting could be done differently) or here (the comment indenting is affecting this project and maybe there's a yaml flag that lets you keep all whitespace), but it's more likely someone will care about it here, so here you go.

fuzzy

Thanks, very useful app!

What I'd appreciate is fuzzy find, so that typing light, for example, would list as well the themes Solarized-Light, etc.

However, thanks again :-)

Error: Document with errors cannot be stringified

Describe the bug
I get the error Document with errors cannot be stringified

Expected behavior
I expect alacritty-themes or npx alacritty-themes to give me the normal menu of available themes, and the up and down arrow keys allow me to switch between them. Instead I get the error Document with errors cannot be stringified

Console output after entering command:

? Select a theme ›
❯   3024.dark
    3024.light
    Afterglow
    Argonaut
    Ashes.dark
    Ashes.light
    Astromouse
    Atelierdune.dark
    Atelierdune.light
  ↓ Atelierforest.dark/home/$USER/.npm/_npx/    808b709e6234a442/node_modules/yaml/dist/        Document-9b4560a1.js:676
    if (this.errors.length > 0) throw new       Error('Document with errors cannot be           stringified');
    ¦   ¦   ¦   ¦   ¦   ¦   ¦   ¦   ¦ ^

Error: Document with errors cannot be           stringified
    at Document.toString (/home/$USER/.npm/_npx/808b709e6234a442/node_modules/yaml/dist/        Document-9b4560a1.js:676:39)
    at String (<anonymous>)
    at updateThemeWithFile (/home/$USER/.npm/   _npx/808b709e6234a442/node_modules/alacritty-   themes/index.js:68:22)
    at updateTheme (/home/$USER/.npm/_npx/      808b709e6234a442/node_modules/alacritty-themes/ index.js:97:10)
    at /home/$USER/.npm/_npx/808b709e6234a442/  node_modules/alacritty-themes/index.js:104:12

alacritty-themes is v4.1.3

How to find out what is the current theme?

I want to switch the theme but I don't remember which is the current one to revert it later.

If there is no such feature, the name could be written as a comment in alacritty.yml.

Suggestion: Live preview

This makes it easy to apply different themes, but it is still a chore finding one I like.

If this had an option to apply the theme (make changes to config) as it is selected, that would make it a lot quicker to use. As alacritty already applies configuration changed immediately while running, this might be possible?

yaml to toml migration

Describe the bug

Alacritty has migrated from yaml to toml.

To Reproduce

Steps to reproduce the behavior:

  1. Build latest version of Alacritty from GitHub
  2. Launch Alacritty and see the response for yaml to toml migration

Consider using include syntax

Instead of adding many configurations to the user's alacritty.yml, you could simply append (or replace) an include:

import:
  - /home/jtm/.config/alacritty/themes/dracula.yml

Making a 1 line change seems pretty solid. Maybe you've considered and want the current solution to be standalone (not requiring other files).

Document with errors cannot be stringified

When starting with npx alacritty-themes, this happens:

Error: Document with errors cannot be stringified
    at Document.toString (/home/ente/.npm/_npx/808b709e6234a442/node_modules/yaml/dist/Document-9b4560a1.js:676:39)
    at String (<anonymous>)
    at updateTheme (/home/ente/.npm/_npx/808b709e6234a442/node_modules/alacritty-themes/index.js:91:22)
    at /home/ente/.npm/_npx/808b709e6234a442/node_modules/alacritty-themes/index.js:104:5
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)

The full output looks like this:

? Select a theme ›
❯   3024.dark
    3024.light
    Afterglow
    Argonaut
    Ashes.dark
    Ashes.light
    Astromouse
    Atelierdune.dark
    Atelierdune.light
  ↓ Atelierforest.dark/home/ente/.npm/_npx/808b709e6234a442/node_modules/yaml/dist/Document-9b4560a1.js:676
    if (this.errors.length > 0) throw new Error('Document with errors cannot be stringified');
                                ^

Error: Document with errors cannot be stringified
    at Document.toString (/home/ente/.npm/_npx/808b709e6234a442/node_modules/yaml/dist/Document-9b4560a1.js:676:39)
    at String (<anonymous>)
    at updateTheme (/home/ente/.npm/_npx/808b709e6234a442/node_modules/alacritty-themes/index.js:91:22)
    at /home/ente/.npm/_npx/808b709e6234a442/node_modules/alacritty-themes/index.js:104:5
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)

The program works as expected when run as just alacritty-themes (without npx)

Direct theme application not working

Describe the bug

Cannot apply a theme directly; the menu list is always shown.

To Reproduce

Steps to reproduce the behavior:

  1. Installation
  • I run it via npx alacritty-themes
  • I installed it via npm i -g alacritty-themes (global installation)
  • I installed it via AUR
  1. Run alacritty-themes
  • Did you add params? yes, I type "alacritty-themes Ayu-Dark"
  • Did you add params? no, I just type "alacritty-themes" then click up/down keys
  1. See error
    image

Expected behavior

The theme should be directly applied.

Operating System:

  • Windows
  • Ubuntu
  • Pop Os
  • Arch
  • Other, which one?

Add your alacritty.yml content

env:
  TERM: alacritty
  LANG: "en_US.UTF-8"
  LC_CTYPE: en_US.UTF-8

font:
  normal:
    family: "monospace"

    style: Regular

  size: 11.0

colors:
  name: 3024 (dark)
  author: Chris Kempson
  primary:
    background: "#090300"
    foreground: "#a5a2a2"
  cursor:
    text: "#090300"
    cursor: "#a5a2a2"
  normal:
    black: "#090300"
    red: "#db2d20"
    green: "#01a252"
    yellow: "#fded02"
    blue: "#01a0e4"
    magenta: "#a16a94"
    cyan: "#b5e4f4"
    white: "#a5a2a2"
  bright:
    black: "#5c5855"
    red: "#db2d20"
    green: "#01a252"
    yellow: "#fded02"
    blue: "#01a0e4"
    magenta: "#a16a94"
    cyan: "#b5e4f4"
    white: "#f7f7f7"
theme: 3024.dark

Remove Node 12 from the CI workflows

Since Node 12 is EOL, we need to remove them from the workflow actions.
And we need to do a new release for the same
@JuanVqz What do you think about the kind of release required for this? major, minor or patch?

Option to pass themes directory

Provide a command line option to specify directory for themes. iTerm2 color themes are the best curated, and available for a range of terminals including Alacritty. A command line option to specify path for themes will make life easy (no merge conflicts between that project and this) and open possibility to have other themes: https://github.com/mbadolato/iTerm2-Color-Schemes

Gracefully handle Ctrl-c and Escape

First of all I'd like to thank for the convenient tool to pick themes. There are some issues I've discovered:
1: The app incorrectly handles Ctrl-c:

  1. Run alacritty-themes
  2. Move to the next theme and quickly press Ctrl-c
    If the interrupt sequence is pressed fast enough, it catches the app in the middle of writing to alacritty.yml, leaving it half-written. The result is the broken config:
    изображение

The app should trap C-c and finish the cleanup first

2: The app incorrectly handles Esc:

  1. Run alacritty-themes
  2. Move to a theme
  3. Press Esc
    Expected: the selection process aborts, leaving the previous theme
    Actual: a theme under cursor is applied like if Enter was pressed.

Select currently applied theme on startup

Am trying to select the currently applied theme on startup. Am planning to use the value in colors.name for this.

For example,

colors:
   name: 3024.dark

I have made few changes. However I noticed that for some themes name is missing. Also the names are not matching the filename. Would it be possible to add name to all themes and keep it same as filename or vice-versa.

Error: Document with errors cannot be stringified

Describe the bug
Just installed the themes and got this error.

To Reproduce
Steps to reproduce the behavior:

  1. Open terminal and type npm i -g alacritty-themes
  2. Type alacritty-theme

Expected behavior
Select the themes

alacritty-themes
? Select a theme ›
❯ 3024.dark
3024.light
Afterglow
Argonaut
Ashes.dark
Ashes.light
Astromouse
Atelierdune.dark
Atelierdune.light
↓ Atelierforest.dark/home/trybe/.nvm/versions/node/v16.13.0/lib/node_modules/alacritty-themes/node_modules/yaml/dist/Document-9b4560a1.js:676
if (this.errors.length > 0) throw new Error('Document with errors cannot be stringified');
^

Error: Document with errors cannot be stringified
at Document.toString (/home/trybe/.nvm/versions/node/v16.13.0/lib/node_modules/alacritty-themes/node_modules/yaml/dist/Document-9b4560a1.js:676:39)
at String ()
at updateThemeWithFile (/home/trybe/.nvm/versions/node/v16.13.0/lib/node_modules/alacritty-themes/index.js:68:22)
at updateTheme (/home/trybe/.nvm/versions/node/v16.13.0/lib/node_modules/alacritty-themes/index.js:97:10)
at /home/trybe/.nvm/versions/node/v16.13.0/lib/node_modules/alacritty-themes/index.js:104:12

alacritty-themes TypeError

Fresh install using

npm i -g alacritty-themes

Getting the following error after running

alacritty-themes
/usr/local/lib/node_modules/alacritty-themes/index.js:40
  ].flat();
    ^

TypeError: [(intermediate value)(intermediate value)(intermediate value),[path.resolve(...),path.resolve(...)]].flat is not a function
    at getAlacrittyConfig (/usr/local/lib/node_modules/alacritty-themes/index.js:40:5)
    at Object.<anonymous> (/usr/local/lib/node_modules/alacritty-themes/index.js:46:17)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/alacritty-themes/bin/cli.js:8:51)

Fix —current argument

Describe the bug

When using the command alacritty-themes —current it shows the current theme as a result until that all good, despide, at the same time, it writes the alacritty.yml file with the current theme's name which is incorrect.

To Reproduce

Steps to reproduce the behavior:

run alacritty-themes —current

Go to the las line in your alacritty.yml file you will see the current name was written there.

  1. Installation
  • I run it via npx alacritty-themes
  1. Run alacritty-themes
  • Did you add params? yes, I type "alacritty-themes —current"
  1. See error

Expected behavior

A clear and concise description of what you expected to happen.

don't write the alacritty file

Operative System:

  • Windows
  • Ubuntu
  • Pop Os
  • Arch
  • Other, which one?

Screenshots

Add screenshots to help explain your problem.

Theme Catpuccin not found

[arshia@arshia-pc alacritty]$ cd
[arshia@arshia-pc ~]$ alacritty-themes Catppucin
node:fs:585
  handleErrorFromBinding(ctx);
  ^

Error: ENOENT: no such file or directory, open '/usr/lib/node_modules/alacritty-themes/themes/Catppucin.yml'
    at Object.openSync (node:fs:585:3)
    at Object.readFileSync (node:fs:453:35)
    at updateThemeWithFile (/usr/lib/node_modules/alacritty-themes/index.js:68:24)
    at updateTheme (/usr/lib/node_modules/alacritty-themes/index.js:117:10)
    at /usr/lib/node_modules/alacritty-themes/index.js:124:12 {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/usr/lib/node_modules/alacritty-themes/themes/Catppucin.yml'
}

Using it the normal way:

[arshia@arshia-pc ~]$ alacritty-themes
? Select a theme ›
❯   3024.dark
    3024.light
    Afterglow
    Argonaut
    Ashes.dark
    Ashes.light
    Astromouse
    Atelierdune.dark
    Atelierdune.light
  ↓ Atelierforest.dark/usr/lib/node_modules/alacritty-themes/index.js:79
    (i) => i.key.value === 'colors'
                 ^

TypeError: Cannot read properties of null (reading 'value')
    at /usr/lib/node_modules/alacritty-themes/index.js:79:18
    at Array.find (<anonymous>)
    at updateThemeWithFile (/usr/lib/node_modules/alacritty-themes/index.js:78:55)
    at updateTheme (/usr/lib/node_modules/alacritty-themes/index.js:117:10)
    at /usr/lib/node_modules/alacritty-themes/index.js:124:12

use_thin_strokes has been removed.

Change in the Config File: alacritty.yml

use_thin_strokes has been removed; Set the AppleFontSmoothing user default instead

To Reproduce

alacritty-themes --create

  1. Installation
  • I installed it via npm i -g alacritty-themes (global installation)

Expected behavior

Expected to show no error warning after changing the theme.

Operating System:

  • Ubuntu

Add your alacritty.yml content

# defective line 
use_thin_strokes: true

Screenshots

Before Resolving the Warning:
image

After Resolving the warning:
image

Replaced the line :

use_thin_strokes: true
# Replaced the above line with
AppleFontSmooting: true

in ~/.config/alacritty/alacritty.yml

v4.1.2 is taking current directory as root directory

Hi, I am the package manager of this in AUR. When i tried to update it i got in to this problem.

Describe the bug
This program takes current directory as the root directory of the package.
In the new update rootDirectory() function takes process.env.PWD as the root directory which causes error like this...

❯ alacritty-themes
? Select a theme ›
❯   3024.dark
    3024.light
    Afterglow
    Argonaut
    Ashes.dark
    Ashes.light
    Astromouse
    Atelierdune.dark
    Atelierdune.light
  ↓ Atelierforest.darknode:fs:585
  handleErrorFromBinding(ctx);
  ^

Error: ENOENT: no such file or directory, open '/home/USER/themes/3024.dark.yml'
    at Object.openSync (node:fs:585:3)
    at Object.readFileSync (node:fs:453:35)
    at updateThemeWithFile (/usr/lib/node_modules/alacritty-themes/index.js:51:24)
    at updateTheme (/usr/lib/node_modules/alacritty-themes/index.js:100:10)
    at /usr/lib/node_modules/alacritty-themes/index.js:107:12 {
  errno: -2,
  syscall: 'open',
  code: 'ENOENT',
  path: '/home/USER/themes/3024.dark.yml'
}

problematic line

To Reproduce
Steps to reproduce the behavior:

  1. install v4.1.2
  2. run alacritty-themes in terminal
  3. See error

Expected behavior
taking root directory as root directory. For linux where its installed as root is "/usr/lib/node_modules/alacritty-themes".

Desktop (please complete the following information):

  • OS: Linux
  • Version v4.1.2

Additional context
I will try to patch it by hard coding the location for now and update the package.

add --help flag

Is your feature request related to a problem? Please describe.
can we add a --help flag in order to list the existent alacrity-themes flags?

Describe alternatives you've considered

$ alacrity-themes --help

command        alias     description
--current          -c          shows current user alacritty theme
--create           -c          creates the an alacritty file

current flag bug

Describe the bug

'alacritty-themes' does not catch readFileSync error in line:

const themeFile = fs.readFileSync(alacrittyConfigPath(), 'utf8');

Error output:

node:internal/fs/utils:670
throw new ERR_INVALID_ARG_TYPE(propName, ['string', 'Buffer', 'URL'], path);
    ^
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined

To Reproduce

Steps to reproduce the behavior:

  1. Delete alacritty config file
  2. Run alacritty-themes --current

Permission to add a theme

I would like to have permission to add a theme.

I already cloned and added the palenight.yml locally.
If thats ok of course.

If that is not possible, could you add a Palenight theme?

making backup doesnt support all linux config paths

Descibe the bug

If alacritty config file is not $HOME/.config/alacritty/alacritty.yml, (in my case it is $HOME/.alacritty.yml) it will throw an error

Steps to reproduce

  1. Installation:
    • installed using npm i -g alacritty-themes
  2. Running:
    • just ran alacritty-themes

Expected Behavior

Running normally, without errors

Operating System

Arch Linux (Manjaro)

Screenshots

alac-bug

I've looked around the source code a bit. Looks like the problem is from createBackup function. On Linux, when it checks if the config exist, it will check both $HOME/.config/alacritty/alacritty.yml and $HOME/.alacritty.yml. But when it creates a backup file it will always use $HOME/.config/alacritty/alacritty.yml

is the master branch protected to doesn't push to it?

Describe the bug

It seems the publishing workflow has been failing because there is a rule that requires at least 1 approving review.

stderr: 'remote: error: GH006: Protected branch update failed for refs/heads/master.        \n' +
    'remote: error: At least 1 approving review is required by reviewers with write access.        \n' +
    'To [https://github.com/rajasegar/alacritty-themes\n](https://github.com/rajasegar/alacritty-themes/n)' +
    ' ! [remote rejected] HEAD -> master (protected branch hook declined)\n' +
    "error: failed to push some refs to 'https://github.com/rajasegar/alacritty-themes'",

To Reproduce

Merge a PR into the master branch

Possible test case

Could you please deactivate the require at least 1 approving review feature, then merge a PR and see if it works?

Expected behavior

The publishing workflow should work

Add support for `yaml` and `yml` theme's extension

Describe the bug

If you add a theme with yaml extension it will fail.

To Reproduce

Steps to reproduce the behavior:

  1. Installation
  • I installed it via npm i -g alacritty-themes (global installation)
  1. Add a theme with YAML extension

  2. Run alacritty-themes

I type "alacritty-themes Fedora"

  1. See error

Expected behavior

Add support to yaml and yaml extensions

Operating System:

  • Windows
  • Ubuntu
  • Pop Os
  • Arch
  • Other, which one?

Add your alacritty.yml content

# your alacritty content here

Screenshots

Add screenshots to help explain your problem.

Cannot apply themes

Getting this error when I try to apply any theme: -

/home/acs/.npm-global/lib/node_modules/alacritty-themes/index.js:22
  const colors = doc.contents.items.filter((i) => i.key.value === "colors")[0];
                              ^

TypeError: Cannot read property 'items' of null
    at updateTheme (/home/acs/.npm-global/lib/node_modules/alacritty-themes/index.js:22:31)
    at /home/acs/.npm-global/lib/node_modules/alacritty-themes/index.js:76:7
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)

Fonts issue

After intalling your utility I get very bad font rendering, and backspaces do not even work. By this I mean:

example

Note that although I use zsh with powerline fonts, starting a vanilla bash, or even sh session does not fix this. I would like to know how to get my terminal back.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.