Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add Croatia style to extras #229

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Please check out the [roadmap](ROADMAP.md) for upcoming features and releases.
- rainbow
- zebra
- america
- croatia
- trap
- random

Expand Down
1 change: 1 addition & 0 deletions examples/normal-usage.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ console.log('This is ' + 'not'.strikethrough + ' fun.');
console.log('Background color attack!'.black.bgWhite);
console.log('Use random styles on everything!'.random);
console.log('America, Heck Yeah!'.america);
console.log('HRVATSKA!'.croatia);


console.log('Setting themes is useful');
Expand Down
1 change: 1 addition & 0 deletions examples/safe-string.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ console.log('This is ' + colors.strikethrough('not') + ' fun.');
console.log(colors.black.bgWhite('Background color attack!'));
console.log(colors.random('Use random styles on everything!'));
console.log(colors.america('America, Heck Yeah!'));
console.log(colors.croatia('HRVATSKA!'));

console.log('Setting themes is useful');

Expand Down
2 changes: 2 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export interface Color {
rainbow: Color;
zebra: Color;
america: Color;
croatia: Color;
trap: Color;
random: Color;
zalgo: Color;
Expand Down Expand Up @@ -87,6 +88,7 @@ export const strikethrough: Color;
export const rainbow: Color;
export const zebra: Color;
export const america: Color;
export const croatia: Color;
export const trap: Color;
export const random: Color;
export const zalgo: Color;
Expand Down
1 change: 1 addition & 0 deletions lib/colors.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ colors.zalgo = require('./custom/zalgo');
// maps
colors.maps = {};
colors.maps.america = require('./maps/america');
colors.maps.croatia = require('./maps/croatia');
colors.maps.zebra = require('./maps/zebra');
colors.maps.rainbow = require('./maps/rainbow');
colors.maps.random = require('./maps/random');
Expand Down
4 changes: 4 additions & 0 deletions lib/extendStringPrototype.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ module['exports'] = function() {
return colors.america(this);
});

addProperty('croatia', function() {
return colors.croatia(this);
});

//
// Iterate through all default styles and colors
//
Expand Down
11 changes: 11 additions & 0 deletions lib/maps/croatia.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var colors = require('../colors');

module['exports'] = (function() {
return function(letter, i, exploded) {
if (letter === ' ') return letter;
switch (i%2) {
case 0: return colors.bgRed(colors.white(letter));
case 1: return colors.bgWhite(colors.red(letter));
}
};
})();
1 change: 1 addition & 0 deletions safe.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ export function strikethrough(str: string): string;
export function rainbow(str: string): string;
export function zebra(str: string): string;
export function america(str: string): string;
export function croatia(str: string): string;
export function trap(str: string): string;
export function random(str: string): string;
export function zalgo(str: string): string;