Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add support for Windows Terminal #37

Open
wants to merge 9 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
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ Save the generated file with `.reg` extension and double click it.
* __Terminator:__
Copy lines within the [profiles] section of the generated configuration file to ~/.config/terminator/config file.

* __Windows Terminal:__

Copy output lines within the 'schemes' array (between the square braces) of the Windows Terminal settings.json file, and give it your own name.

* __Other terminals:__
Generate one of the supported formats and copy hex values into the configuration file (or tool) of your terminal.

Expand Down Expand Up @@ -67,6 +71,10 @@ __Victor Hugo Borja__
* http://github.com/vic
* http://twitter.com/vborja

__Victor Wheeler__

- http://github.com/vwheeler63

Resources
---------

Expand Down
Binary file added favicon.ico
Binary file not shown.
4 changes: 4 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*.colorscheme (konsole, yakuake) and *.itermcolors
(iTerm2 for Mac)"/>
<link href="css/merged.css?modified=20120923" rel="stylesheet" />
<link rel="icon" type="image/ico" href="./favicon.ico"/>
<style id="outline-fix"></style>
</head>
<body onmousedown="document.getElementById('outline-fix').innerHTML='a{outline:none}';" onkeydown="document.getElementById('outline-fix').innerHTML=''">
Expand Down Expand Up @@ -134,6 +135,9 @@ <h2>Advanced</h2>
<li>
<p>terminator <a href="#" target="_blank" id="terminator-button" class="get-scheme-link">config</a>
</li>
<li>
<p>Windows Terminal<a href="#" target="_blank" id="windows-terminal-button" class="get-scheme-link">settings.json</a>
</li>
</ul>
</div>

Expand Down
67 changes: 64 additions & 3 deletions js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,13 +469,13 @@ _4bit = function() {
_.each(COLOR_NAMES, function(name) {
if (0 !== name.indexOf('bright_')) {
palette.push( gnomeColor(colors[name]) );
}
}
});

_.each(COLOR_NAMES, function(name) {
if (0 === name.indexOf('bright_')) {
palette.push( gnomeColor(colors[name]) );
}
}
});

out = '#!/bin/bash \n\n';
Expand Down Expand Up @@ -891,6 +891,66 @@ _4bit = function() {
}
});

var SchemeWindowsTerminalView = Backbone.View.extend({

model: scheme,

initialize: function() {
_.bindAll(this, 'render');
var that = this;
$('#windows-terminal-button').hover(function() {
that.render();
});
$('#windows-terminal-button').focus(function() {
that.render();
});
},

render: function() {
var that = this;
var lsResult = '';
var counter = 0;

lsResult += '// --- ~/.settings.json ---------------------------------------------------------\n';
lsResult += '// --- Copy the text below including the curly braces {...} and paste into ---\n';
lsResult += '// --- schemes [] array in settings.json of Windows Terminal. ---\n';
lsResult += '// ------------------------------------------------------------------------------\n';
lsResult += '// --- generated with 4bit Terminal Color Scheme Designer -----------------------\n';
lsResult += '// ------------------------------------------------------------------------------\n';
lsResult += '// --- http://ciembor.github.com/4bit -------------------------------------------\n';
lsResult += '// --- with Windows Terminal code by Victor Wheeler. ----------------------------\n';
lsResult += '// ------------------------------------------------------------------------------\n\n';
lsResult += ' {\n';
lsResult += ' "name" : "your_name",\n';
lsResult += ' "black" : "' + that.model.get('colors')['black'] + '",\n';
lsResult += ' "red" : "' + that.model.get('colors')['red'] + '",\n';
lsResult += ' "green" : "' + that.model.get('colors')['green'] + '",\n';
lsResult += ' "yellow" : "' + that.model.get('colors')['yellow'] + '",\n';
lsResult += ' "blue" : "' + that.model.get('colors')['blue'] + '",\n';
lsResult += ' "purple" : "' + that.model.get('colors')['magenta'] + '",\n';
lsResult += ' "cyan" : "' + that.model.get('colors')['cyan'] + '",\n';
lsResult += ' "white" : "' + that.model.get('colors')['white'] + '",\n';
lsResult += ' "brightBlack" : "' + that.model.get('colors')['bright_black'] + '",\n';
lsResult += ' "brightRed" : "' + that.model.get('colors')['bright_red'] + '",\n';
lsResult += ' "brightGreen" : "' + that.model.get('colors')['bright_green'] + '",\n';
lsResult += ' "brightYellow" : "' + that.model.get('colors')['bright_yellow'] + '",\n';
lsResult += ' "brightBlue" : "' + that.model.get('colors')['bright_blue'] + '",\n';
lsResult += ' "brightPurple" : "' + that.model.get('colors')['bright_magenta'] + '",\n';
lsResult += ' "brightCyan" : "' + that.model.get('colors')['bright_cyan'] + '",\n';
lsResult += ' "brightWhite" : "' + that.model.get('colors')['bright_white'] + '",\n';
lsResult += ' // --- special colors ---\n';
lsResult += ' "background" : "' + that.model.get('colors')['background'] + '",\n';
lsResult += ' "foreground" : "' + that.model.get('colors')['foreground'] + '"\n';
lsResult += ' },\n\n';
lsResult += '// ------------------------------------------------------------------------------\n';
lsResult += '// --- end of terminal colors section -------------------------------------------\n';
lsResult += '// ------------------------------------------------------------------------------\n\n';

$('#windows-terminal-button').attr('href', 'data:text/plain,' + encodeURIComponent(lsResult));
}

});

var ControlsView = Backbone.View.extend({

el: $('#controls'),
Expand Down Expand Up @@ -1055,6 +1115,7 @@ _4bit = function() {
var schemeXfceTerminalView = new SchemeXfceTerminalView();
var schemePuttyView = new SchemePuttyView();
var schemeTerminatorView = new SchemeTerminatorView();
var schemeWindowsTerminalView = new SchemeWindowsTerminalView();
var controlsView = new ControlsView();

// basic layout behaviour /////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion less/main.less
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ body {
}

#get-scheme-button {
width: 116px;
width: 126px;
border: 1px solid #ccc;

span {
Expand Down