Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hyper-star-wars

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hyper-star-wars - npm Package Compare versions

Comparing version 2.0.0 to 3.0.0

docs/index.html

374

index.js

@@ -0,205 +1,201 @@

'use strict';
const fs = require('fs');
const path = require('path');
const color = require('color');
const yaml = require('js-yaml');
const homeDir = require('home-dir');
const path = homeDir('/.hyper_plugins/node_modules/hyper-star-wars/backgrounds/');
const extension = '.png';
const filepaths = {
backgrounds: path.resolve(__dirname, 'backgrounds')
};
exports.decorateConfig = config => {
let keys;
let theme;
let index;
const colorSchemes = {
characters: path.resolve(__dirname, 'characters.yml'),
sides: path.resolve(__dirname, 'sides.yml')
};
// Get the character option - defaults to 'yoda'
const character = config.StarWarsTheme ? (config.StarWarsTheme.character || 'yoda') : 'yoda';
function getThemes() {
const themes = {};
Object.keys(colorSchemes).forEach(category => {
Object.assign(themes, yaml.safeLoad(fs.readFileSync(colorSchemes[category], 'utf8')));
});
return themes;
}
// Get the lightsaber option - defaults to 'true'
const lightsaber = config.StarWarsTheme ? (config.StarWarsTheme.lightsaber || 'true') : 'true';
const lightsaberFlag = lightsaber !== 'false';
function getUserOptions(configObj) {
const config = configObj.StarWarsTheme;
return Object.assign({}, {
get avatar() {
return (config.avatar || 'true') !== 'false';
},
get character() {
if (Array.isArray(config.character)) {
return config.character[Math.floor(Math.random() * config.character.length)];
}
return config.character || 'yoda';
},
get lightsaber() {
return (config.lightsaber || 'false') === 'true';
},
get unibody() {
return (config.unibody || 'true') !== 'false';
}
});
}
// Get the unibody option - defaults to 'false'
const unibody = config.StarWarsTheme ? (config.StarWarsTheme.unibody || 'false') : 'false';
const unibodyFlag = unibody !== 'false';
function getRandomTheme(category) {
const index = Math.floor(Math.random() * (Object.keys(category).length));
const name = Object.keys(category)[index];
return [name, category[name]];
}
// Get the avatar option - defaults to 'true'
const avatar = config.StarWarsTheme ? (config.StarWarsTheme.avatar || 'true') : 'true';
const avatarFlag = avatar !== 'false';
function getThemeColors(theme) {
const themes = getThemes();
const name = theme.trim().toLowerCase();
if (name === 'random') {
return getRandomTheme(themes.characters);
}
if (Object.prototype.hasOwnProperty.call(themes, name)) {
// Choose a random theme from the given category -- i.e. `light`
return getRandomTheme(themes[name]);
}
if (Object.prototype.hasOwnProperty.call(themes.characters, name)) {
// Return the requested character theme -- i.e. `bb8`
return [name, themes.characters[name]];
}
// Got non-existent theme name thus resolve to default
return ['yoda', themes.characters.yoda];
}
// Get a random character in case of a character array
const getTheme = Array.isArray(character) ? config.StarWarsTheme.character[Math.floor(Math.random() * config.StarWarsTheme.character.length)] : character;
// Make it lower-case
let starWarsTheme = getTheme.toLowerCase();
function getImagePath(character) {
const imagePath = [];
imagePath.push(...[path.join(filepaths.backgrounds, character), '.png']);
if (process.platform === 'win32') {
return imagePath.join('').replace(/\\/g, '/');
}
return imagePath.join('');
}
// Load color palettes from yaml files
const charactersYml = yaml.safeLoad(
fs.readFileSync(
homeDir('/.hyper_plugins/node_modules/hyper-star-wars/characters.yml'),
'utf8'
)
);
exports.decorateConfig = config => {
// Get user options
const options = getUserOptions(config);
const [themeName, colors] = getThemeColors(options.character);
const imagePath = getImagePath(themeName);
const sidesYml = yaml.safeLoad(
fs.readFileSync(
homeDir('/.hyper_plugins/node_modules/hyper-star-wars/sides.yml'),
'utf8'
)
);
// Set theme colors
const primary = options.unibody ? colors.unibody : colors.header;
const fontColor = colors.font;
const unibodyColor = colors.unibody;
const activeTab = colors.tabs;
const header = color(primary).isDark() ? '#FAFAFA' : '#383A42';
const tab = color(activeTab).darken(0.1);
const selection = color(colors.header).alpha(0.5).string();
const transparent = color(primary).alpha(0).string();
// Determine theme color palette
if (starWarsTheme === 'random') {
keys = Object.keys(charactersYml.characters);
index = Math.floor(Math.random() * (keys.length));
starWarsTheme = keys[index];
} else if (starWarsTheme === 'light') {
keys = Object.keys(sidesYml.light);
index = Math.floor(Math.random() * (keys.length));
starWarsTheme = keys[index];
} else if (starWarsTheme === 'dark') {
keys = Object.keys(sidesYml.dark);
index = Math.floor(Math.random() * (keys.length));
starWarsTheme = keys[index];
}
// Set lightsaber
const barSaber = options.lightsaber ? `0 0 10px ${fontColor}` : '';
if (Object.prototype.hasOwnProperty.call(charactersYml.characters, starWarsTheme)) {
theme = charactersYml.characters[starWarsTheme];
} else {
theme = charactersYml.default.yoda;
}
// Set background
const themeAvatar = `url("file://${imagePath}") center;`;
const backgroundContent = options.avatar ? themeAvatar : unibodyColor;
// Set theme colors
const primary = (unibodyFlag === true) ? theme.unibody : theme.header;
const fontColor = theme.font;
const tabsColor = theme.tabs;
const selectedColor = theme.header;
const unibodyColor = theme.unibody;
const themeBlack = theme.black;
const themeRed = theme.red;
const themeGreen = theme.green;
const themeYellow = theme.yellow;
const themeBlue = theme.blue;
const themeMagenta = theme.magenta;
const themeCyan = theme.cyan;
const themeWhite = theme.white;
const themeLightBlack = theme.lightBlack;
const themeLightRed = theme.lightRed;
const themeLightGreen = theme.lightGreen;
const themeLightYellow = theme.lightYellow;
const themeLightBlue = theme.lightBlue;
const themeLightMagenta = theme.lightMagenta;
const themeLightCyan = theme.lightCyan;
const themeLightWhite = theme.lightWhite;
const scheme = {
backgroundColor: transparent,
borderColor: primary,
cursorColor: fontColor,
foregroundColor: fontColor,
selectionColor: selection,
colors: {
black: colors.black,
red: colors.red,
green: colors.green,
yellow: colors.yellow,
blue: colors.blue,
magenta: colors.magenta,
cyan: colors.cyan,
white: colors.white,
lightBlack: colors.lightBlack,
lightRed: colors.lightRed,
lightGreen: colors.lightGreen,
lightYellow: colors.lightYellow,
lightBlue: colors.lightBlue,
lightMagenta: colors.lightMagenta,
lightCyan: colors.lightCyan,
lightWhite: colors.lightWhite
}
};
const syntax = {
scheme: {
borderColor: primary,
cursorColor: fontColor,
foregroundColor: fontColor,
backgroundColor: tabsColor,
colors: {
black: themeBlack,
red: themeRed,
green: themeGreen,
yellow: themeYellow,
blue: themeBlue,
magenta: themeMagenta,
cyan: themeCyan,
white: themeWhite,
lightBlack: themeLightBlack,
lightRed: themeLightRed,
lightGreen: themeLightGreen,
lightYellow: themeLightYellow,
lightBlue: themeLightBlue,
lightMagenta: themeLightMagenta,
lightCyan: themeLightCyan,
lightWhite: themeLightWhite
}
}
};
let pathToTheme;
const assemblePath = path + starWarsTheme + extension;
// Lightsaber effect settings
const cursorSaber = (lightsaberFlag === true) ? '0 0 10px 2px ' + fontColor : '';
const barSaber = (lightsaberFlag === true) ? '0 0 10px ' + fontColor : '';
if (process.platform === 'win32') {
pathToTheme = assemblePath.replace(/\\/g, '/');
} else {
pathToTheme = assemblePath;
}
// Background settings
const themeAvatar = 'url("file://' + pathToTheme + '") center';
const backgroundContent = (avatarFlag === true) ? themeAvatar : unibodyColor;
return Object.assign({}, config,
syntax.scheme, {
termCSS: `
${config.termCSS || ''}
.cursor-node {
-webkit-box-shadow: ${cursorSaber};
}
::selection {
background: ${selectedColor} !important;
}
::-webkit-scrollbar-thumb {
background-color: ${fontColor};
-webkit-box-shadow: ${barSaber};
}
x-screen {
background: transparent !important;
}
`,
css: `
${config.css || ''}
.terms_terms {
background: ${backgroundContent};
background-size: cover;
}
.header_header, .header_windowHeader {
background-color: ${primary} !important;
}
.tabs_nav .tabs_list {
border-bottom: 0;
}
.tabs_nav .tabs_title,
.tabs_nav .tabs_list .tab_tab {
color: ${fontColor};
border: 0;
}
.tab_icon {
color: ${fontColor};
}
.tab_icon:hover {
background-color: ${fontColor};
}
.tabs_nav .tabs_list .tab_tab:not(.tab_active) {
background-color: rgba(0,0,0,0.1);
}
.tabs_nav .tabs_list {
color: ${primary};
}
.tab_tab::before {
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 4px;
background-color: ${fontColor};
transform: scaleX(0);
transition: none;
-webkit-box-shadow: ${barSaber};
}
.tab_tab.tab_active::before {
transform: scaleX(1);
transition: all 400ms cubic-bezier(0.0, 0.0, 0.2, 1)
}
.terms_terms .terms_termGroup .splitpane_panes .splitpane_divider {
background-color: ${fontColor} !important;
}
`
}
);
return Object.assign({}, config, scheme, {
termCSS: `
${config.termCSS || ''}
::-webkit-scrollbar-thumb {
background-color: ${fontColor};
-webkit-box-shadow: ${barSaber};
}
`,
css: `
${config.css || ''}
.terms_terms {
background: ${backgroundContent};
background-size: cover;
}
.header_shape, .header_appTitle {
color: ${header};
}
.header_header, .header_windowHeader {
background-color: ${primary} !important;
}
.tabs_nav .tabs_list {
border-bottom: 0;
}
.tabs_nav .tabs_title,
.tabs_nav .tabs_list .tab_tab {
color: ${fontColor};
border: 0;
}
.tab_icon {
color: ${fontColor};
width: 15px;
height: 15px;
}
.tab_icon:hover {
background-color: ${fontColor};
}
.tab_shape {
color: ${unibodyColor};
width: 7px;
height: 7px;
}
.tab_shape:hover {
color: ${unibodyColor};
}
.tab_active {
background-color: ${activeTab};
}
.tabs_nav .tabs_list .tab_tab:not(.tab_active) {
background-color: ${tab};
}
.tabs_nav .tabs_list {
color: ${primary};
}
.tab_tab::before {
content: '';
position: absolute;
bottom: 0;
left: 0;
right: 0;
height: 4px;
background-color: ${fontColor};
transform: scaleX(0);
transition: none;
-webkit-box-shadow: ${barSaber};
}
.tab_tab.tab_active::before {
transform: scaleX(1);
transition: all 400ms cubic-bezier(0.0, 0.0, 0.2, 1)
}
.terms_terms .terms_termGroup .splitpane_panes .splitpane_divider {
background-color: ${fontColor} !important;
}
`
});
};
{
"name": "hyper-star-wars",
"version": "2.0.0",
"version": "3.0.0",
"description": "🚀Super awesome, your Hyper terminal shall look.",

@@ -11,3 +11,3 @@ "license": "MIT",

"email": "klauscfhq@protonmail.com",
"url": "https://cookfood.me"
"url": "https://klauscfhq.github.io"
},

@@ -38,9 +38,13 @@ "maintainers": [

"dependencies": {
"home-dir": "~1.0",
"js-yaml": "~3.10"
"color": "^3.0.0",
"home-dir": "^1.0.0",
"js-yaml": "^3.10.0"
},
"devDependencies": {
"xo": "~0.18",
"yaml-lint": "~1.0"
"xo": "^0.20.3",
"yaml-lint": "^1.0.0"
},
"xo": {
"space": 2
}
}
<h1 align="center">
<a href="https://github.com/klauscfhq/hyper-star-wars">
<img src="https://cdn.rawgit.com/champloohq/hyper-star-wars/f76cf2d0/media/header.png" alt="Hyper Star Wars" width="100%">
</a>
<img src="https://cdn.rawgit.com/klauscfhq/hyper-star-wars/32d811df/media/logo.png" width="30%"><br/>Hyper Star Wars
</h1>
> 🚀Super awesome, your Hyper terminal shall look.
<h4 align="center">
🚀 Super awesome, your Hyper terminal shall look.
</h4>
[![May the Force be will you](https://img.shields.io/badge/May%20the%20Force-be%20with%20you-green.svg)](https://github.com/klauscfhq/hyper-star-wars) [![Build Status](https://travis-ci.org/klauscfhq/hyper-star-wars.svg?branch=master)](https://travis-ci.org/klauscfhq/hyper-star-wars) [![Dependency Status](https://dependencyci.com/github/klauscfhq/hyper-star-wars/badge)](https://dependencyci.com/github/klauscfhq/hyper-star-wars) [![Gitter](https://img.shields.io/gitter/room/nwjs/nw.js.svg)](https://gitter.im/klauscfhq/hyper-star-wars) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg)](https://github.com/klauscfhq/hyper-star-wars) [![Latest version](https://badge.fury.io/gh/klauscfhq%2Fhyper-star-wars.svg)](https://github.com/kklauscfhq/hyper-star-wars/releases) [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/bnb/awesome-hyper)
<div align="center">
<a href="https://github.com/klauscfhq/hyper-star-wars">
<img src="https://cdn.rawgit.com/klauscfhq/hyper-star-wars/32d811df/media/example.png" alt="Hyper Star Wars" width="95%">
</a>
</div>
<p align="center">
<a href="https://github.com/klauscfhq/hyper-star-wars">
<img alt="May the Force be will you" src="https://img.shields.io/badge/May%20the%20Force-be%20with%20you-green.svg">
</a>
<a href="https://travis-ci.org/klauscfhq/hyper-star-wars">
<img alt="Build Status" src="https://travis-ci.org/klauscfhq/hyper-star-wars.svg?branch=master">
</a>
<a href="https://tidelift.com/repo/github/klauscfhq/hyper-star-wars">
<img alt="Dependency Status" src="https://tidelift.com/badges/github/klauscfhq/hyper-star-wars?style=flat">
</a>
<a href="https://github.com/klauscfhq/hyper-star-wars">
<img alt="XO code style" src="https://img.shields.io/badge/code_style-XO-5ed9c7.svg">
</a>
<a href="https://gitter.im/klauscfhq/hyper-star-wars">
<img alt="Gitter" src="https://img.shields.io/gitter/room/nwjs/nw.js.svg">
</a>
<a href="https://github.com/klauscfhq/hyper-star-wars">
<img alt="npm" src="https://img.shields.io/npm/dt/hyper-star-wars.svg">
</a>
<a href="https://github.com/bnb/awesome-hyper">
<img alt="Awesome" src="https://awesome.re/mentioned-badge.svg">
</a>
</p>
## Contents

@@ -17,3 +45,3 @@

- [Options](#options)
- [Star Wars Characters](#star-wars-characters)
- [Available Themes](#available-themes)
- [Related](#related)

@@ -29,3 +57,3 @@ - [Team](#team)

Do you enjoy this project? Maybe you love **Pokémon**? Then, you will also love our [Hyper Pokémon](https://github.com/champloohq/hyper-pokemon) ![](media/pikachu.gif) theme project. Go take a peek.
Do you enjoy this project? Maybe you love **Pokémon**? Then, you will also love our [Hyper Pokémon](https://github.com/klauscfhq/hyper-pokemon) ![](media/pikachu.gif) theme project. Go take a peek.

@@ -99,3 +127,3 @@ Come over to our [Gitter](https://gitter.im/klauscfhq/hyper-star-wars) chat to share your thoughts on the project or to just say hi.

- `character name` - choose any of the [available Star Wars characters](#star-wars-characters) by defining their name.<br/><br/>**i.e.** `character: 'yoda'`, `character: 'darth-vader'`, `character: 'bb8'` **etc**<br/><br/>
- `character name` - choose any of the [available Star Wars characters](#available-themes) by defining their name.<br/><br/>**i.e.** `character: 'yoda'`, `character: 'darth-vader'`, `character: 'bb8'` **etc**<br/><br/>

@@ -117,3 +145,3 @@ - `random` - randomly selects a Star Wars character theme from **all available characters**, each time you fire up a new Hyper terminal session.<br/><br/>

Activates your theme's `lightsaber` mode, making your terminal's `cursor`, `tab bar` & `scroll bar` glow!
Activates your theme's `lightsaber` mode, making your terminal's `tab bar` glow.

@@ -125,3 +153,3 @@ The assignable values are:

Also, completely omitting the `lightsaber` option from your `.hyper.js` will have the same effect as defining it and setting it to `true`. (**default state**)
Also, completely omitting the `lightsaber` option from your `.hyper.js` will have the same effect as defining it and setting it to `false`. (**Default value**)

@@ -139,3 +167,3 @@ ![](media/lightsaber-example.png)

In addition, completely omitting the `unibody` option from your `.hyper.js` will have the same effect as defining it and setting it to `true`. (**default state**)
In addition, completely omitting the `unibody` option from your `.hyper.js` will have the same effect as defining it and setting it to `true`. (**Default value**)

@@ -153,109 +181,40 @@ ![](media/unibody-example.png)

In addition, completely omitting the `avatar` option from your `.hyper.js` will have the same effect as defining it and setting it to `true`. (**default state**)
In addition, completely omitting the `avatar` option from your `.hyper.js` will have the same effect as defining it and setting it to `true`. (**Default value**)
![](media/avatar-example.png)
## Star Wars Characters
## Available Themes
### `darth-vader`
You can preview in detail all of the themes [here](https://klauscfhq.github.io/hyper-star-wars).
![](media/darth-vader.png)
<details>
<summary>View all the available Star Wars characters</summary>
<summary>List of all the available themes.</summary>
<br/>
### `yoda`
* `darth-vader`
* `yoda`
* `stormtrooper`
* `r2d2`
* `chewbacca`
* `snowtrooper`
* `kylo-ren`
* `bb8`
* `obi-wan-kenobi`
* `luke-skywalker-older`
* `emperor`
* `spacetrooper`
* `c3po`
* `finn`
* `boba-fett`
* `leia-organa`
* `maz-kanata`
* `finn-stormtrooper`
* `han-solo`
* `luke-skywalker`
* `rey`
* `princess-leia`
* `poe-dameron`
* `han-solo-older`
![](media/yoda.png)
### `stormtrooper`
![](media/stormtrooper.png)
### `r2d2`
![](media/r2d2.png)
### `chewbacca`
![](media/chewbacca.png)
### `snowtrooper`
![](media/snowtrooper.png)
### `kylo-ren`
![](media/kylo-ren.png)
### `bb8`
![](media/bb8.png)
### `obi-wan-kenobi`
![](media/obi-wan-kenobi.png)
### `luke-skywalker-older`
![](media/luke-skywalker-older.png)
### `emperor`
![](media/emperor.png)
### `spacetrooper`
![](media/spacetrooper.png)
### `c3po`
![](media/c3po.png)
### `finn`
![](media/finn.png)
### `boba-fett`
![](media/boba-fett.png)
### `leia-organa`
![](media/leia-organa.png)
### `maz-kanata`
![](media/maz-kanata.png)
### `finn-stormtrooper`
![](media/finn-stormtrooper.png)
### `han-solo`
![](media/han-solo.png)
### `luke-skywalker`
![](media/luke-skywalker.png)
### `rey`
![](media/rey.png)
### `princess-leia`
![](media/princess-leia.png)
### `poe-dameron`
![](media/poe-dameron.png)
### `han-solo-older`
![](media/han-solo-older.png)
<br/>

@@ -269,11 +228,10 @@

- [Hyper Pokemon](https://github.com/champloohq/hyper-pokemon) - 🌈 Tailor-made Pokémon themes for your Hyper terminal.
- [Hyper Pokemon](https://github.com/klauscfhq/hyper-pokemon) - 🌈 Tailor-made Pokémon themes for your Hyper terminal.
## Team
Meet the team and all the [contributors](https://github.com/champloohq/hyper-star-wars/blob/master/authors.md). <br/>
Coded with ❤ by
[![Klaus Sinani](https://avatars.githubusercontent.com/u/12670537?s=130)](https://github.com/klauscfhq) | [![Mario Sinani](https://avatars.githubusercontent.com/u/29512262?s=130)](https://github.com/mariocfhq)
--- | ---
[Klaus Sinani](https://github.com/klauscfhq) | [Mario Sinani](https://github.com/mariocfhq)
- Klaus Sinani [(@klauscfhq)](https://github.com/klauscfhq)
- Mario Sinani [(@mariocfhq)](https://github.com/mariocfhq)

@@ -280,0 +238,0 @@ ## License

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc