-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
3,327 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
root = true | ||
|
||
[*] | ||
indent_style = space | ||
indent_size = 2 | ||
end_of_line = lf | ||
charset = utf-8 | ||
trim_trailing_whitespace = false | ||
insert_final_newline = true | ||
|
||
[*.md] | ||
trim_trailing_whitespace = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# See http://help.github.com/ignore-files/ for more about ignoring files. | ||
|
||
# compiled output | ||
/dist | ||
/tmp | ||
|
||
# dependencies | ||
/node_modules | ||
/bower_components | ||
|
||
# misc | ||
.DS_Store | ||
/.sass-cache | ||
/connect.lock | ||
/coverage/* | ||
/libpeerconnection.log | ||
npm-debug.log | ||
testem.log | ||
|
||
.env* | ||
.vscode-test | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
sudo: false | ||
|
||
language: node_js | ||
|
||
node_js: | ||
- "6" | ||
cache: | ||
yarn: true | ||
directories: | ||
- node_modules | ||
os: | ||
- osx | ||
- linux | ||
before_install: | ||
- if [ $TRAVIS_OS_NAME == "linux" ]; then | ||
export CXX="g++-4.9" CC="gcc-4.9" DISPLAY=:99.0; | ||
sh -e /etc/init.d/xvfb start; | ||
sleep 3; | ||
fi | ||
|
||
install: | ||
- npm install -g yarn | ||
- yarn | ||
- yarn run vscode:prepublish | ||
|
||
script: | ||
- yarn test --silent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// A launch configuration that compiles the extension and then opens it inside a new window | ||
{ | ||
"version": "0.1.0", | ||
"configurations": [ | ||
{ | ||
"name": "Launch Extension", | ||
"type": "extensionHost", | ||
"request": "launch", | ||
"runtimeExecutable": "${execPath}", | ||
"args": ["--extensionDevelopmentPath=${workspaceRoot}" ], | ||
"stopOnEntry": false, | ||
"sourceMaps": true, | ||
"outDir": "${workspaceRoot}/out/src", | ||
"preLaunchTask": "npm" | ||
}, | ||
{ | ||
"name": "Launch Tests", | ||
"type": "extensionHost", | ||
"request": "launch", | ||
"runtimeExecutable": "${execPath}", | ||
"args": ["--extensionDevelopmentPath=${workspaceRoot}", "--extensionTestsPath=${workspaceRoot}/out/test" ], | ||
"stopOnEntry": false, | ||
"sourceMaps": true, | ||
"outDir": "${workspaceRoot}/out/test", | ||
"preLaunchTask": "npm" | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Place your settings in this file to overwrite default and user settings. | ||
{ | ||
"files.exclude": { | ||
"out": false // set this to true to hide the "out" folder with the compiled JS files | ||
}, | ||
"search.exclude": { | ||
"out": true // set this to false to include "out" folder in search results | ||
}, | ||
"typescript.tsdk": "./node_modules/typescript/lib" // we want to use the TS server from our node_modules folder to control its version | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// Available variables which can be used inside of strings. | ||
// ${workspaceRoot}: the root folder of the team | ||
// ${file}: the current opened file | ||
// ${fileBasename}: the current opened file's basename | ||
// ${fileDirname}: the current opened file's dirname | ||
// ${fileExtname}: the current opened file's extension | ||
// ${cwd}: the current working directory of the spawned process | ||
|
||
// A task runner that calls a custom npm script that compiles the extension. | ||
{ | ||
"version": "0.1.0", | ||
|
||
// we want to run npm | ||
"command": "npm", | ||
|
||
// the command is a shell script | ||
"isShellCommand": true, | ||
|
||
// show the output window only if unrecognized errors occur. | ||
"showOutput": "silent", | ||
|
||
// we run the custom script "compile" as defined in package.json | ||
"args": ["run", "compile", "--loglevel", "silent"], | ||
|
||
// The tsc compiler is started in watching mode | ||
"isWatching": true, | ||
|
||
// use the standard tsc in watch mode problem matcher to find compile problems in the output. | ||
"problemMatcher": "$tsc-watch" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.vscode/** | ||
.vscode-test/** | ||
out/test/** | ||
test/** | ||
src/** | ||
**/*.map | ||
.gitignore | ||
tsconfig.json | ||
vsc-extension-quickstart.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Colorize README | ||
|
||
Colorize will scan your css files looking for colors and generate a background for each of them. | ||
The background is generated from the color. | ||
|
||
![](assets/demo.gif) | ||
|
||
## Features | ||
|
||
Generate background for css hexa color | ||
|
||
<!--Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file. | ||
For example if there is an image subfolder under your extension project workspace: | ||
> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.--> | ||
|
||
## Known Issues | ||
|
||
Calling out known issues can help limit users opening duplicate issues against your extension. | ||
|
||
## Release Notes | ||
|
||
### Latest 0.1.0 (2017.01.17) | ||
|
||
- First Release | ||
- Add support for css hexa colors | ||
|
||
See [CHANGELOG](CHANGELOG.md) for more information. | ||
|
||
## Roadmap | ||
|
||
These depend on the feedback and user requests. | ||
|
||
## Contributing | ||
|
||
Bugs, feature requests and more, in [GitHub Issues](https://github.com/KamiKillertO/vscode_colorize/issues). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
environment: | ||
ELECTRON_RUN_AS_NODE: 1 | ||
VSCODE_BUILD_VERBOSE: true | ||
|
||
platform: | ||
- x86 | ||
- x64 | ||
|
||
install: | ||
- ps: Install-Product node 6 | ||
- yarn | ||
|
||
cache: | ||
- "%LOCALAPPDATA%\\Yarn" | ||
|
||
test_script: | ||
- node --version | ||
- yarn --version | ||
- npm run vscode:prepublish | ||
- npm test --silent | ||
# - .\scripts\test.bat | ||
# - .\scripts\test-integration.bat | ||
|
||
# Don't actually build. | ||
build: off |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
{ | ||
"name": "vscode-colorize", | ||
"displayName": "colorize", | ||
"description": "A vscode extension to help visualize css colors in files.", | ||
"version": "0.1.0", | ||
"publisher": "KamiKillertO", | ||
"license": "Apache-2.0", | ||
"icon": "assets/logo.png", | ||
"engines": { | ||
"vscode": "^1.5.0" | ||
}, | ||
"categories": [ | ||
"Other" | ||
], | ||
"keywords": [ | ||
"hsl", | ||
"rgb", | ||
"rgba", | ||
"color", | ||
"css", | ||
"hexa", | ||
"sass", | ||
"scss", | ||
"less" | ||
], | ||
"galleryBanner": { | ||
"color": "#87CEFA", | ||
"theme": "dark" | ||
}, | ||
"activationEvents": [ | ||
"onLanguage:css", | ||
"onLanguage:sass", | ||
"onLanguage:scss", | ||
"onLanguage:less" | ||
], | ||
"main": "./out/src/extension", | ||
"contributes": { | ||
"commands": [] | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/KamiKillertO/vscode_colorize/issues" | ||
}, | ||
"homepage": "https://github.com/KamiKillertO/vscode_colorize", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/KamiKillertO/vscode_colorize.git" | ||
}, | ||
"scripts": { | ||
"vscode:prepublish": "tsc -p ./", | ||
"compile": "tsc -p ./", | ||
"watch": "tsc -watch -p ./", | ||
"postinstall": "node ./node_modules/vscode/bin/install", | ||
"lint": "node ./node_modules/tslint/lib/tslint-cli.js -c tslint.json --project tsconfig.json", | ||
"test": "node ./node_modules/vscode/bin/test" | ||
}, | ||
"devDependencies": { | ||
"@types/chai": "3.4.34", | ||
"@types/mocha": "2.2.37", | ||
"@types/node": "6.0.50", | ||
"chai": "3.5.0", | ||
"mocha": "3.2.0", | ||
"node-pre-gyp": "0.6.32", | ||
"tslint": "4.3.1", | ||
"typescript": "2.1.5", | ||
"vscode": "1.0.3" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict'; | ||
|
||
// const COLOR_REGEX = /(#(?:[\da-f]{3}){1,2}|rgb\((?:\d{1,3},\s*){2}\d{1,3}\)|rgba\((?:\d{1,3},\s*){3}\d*\.?\d+\)|hsl\(\d{1,3}(?:,\s*\d{1,3}%){2}\)|hsla\(\d{1,3}(?:,\s*\d{1,3}%){2},\s*\d*\.?\d+\))/gi | ||
// const HEXA_COLOR = /#(?:[\da-f]{3}($| |,|;)){1}|(?:(#(?:[\da-f]{3}){2})(\t|$| |,|;))/gi | ||
|
||
|
||
/** | ||
* Utils object for color manipulation | ||
*/ | ||
export const HEXA_COLOR = /(#[\da-f]{3}|#[\da-f]{6})($|,| |;|\n)/gi; | ||
|
||
export default { | ||
HEXA_COLOR | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { HEXA_COLOR } from './color-regex'; | ||
|
||
const ColorUtil = { | ||
getRGB(color: string): number[] { | ||
let rgb: any[] = []; | ||
if (color.match(HEXA_COLOR)) { | ||
rgb = /#(.+)/gi.exec(color); | ||
if (rgb[1].length === 3) { | ||
return rgb[1].split('').map(_ => parseInt(_ + _, 16)); | ||
} | ||
rgb = rgb[1].split('').map(_ => parseInt(_, 16)); | ||
return [16 * rgb[0] + rgb[1], 16 * rgb[2] + rgb[3], 16 * rgb[4] + rgb[5]]; | ||
} | ||
return []; | ||
}, | ||
|
||
luminance(color: string): number { | ||
let rgb = this.getRGB(color); | ||
if (!rgb) { | ||
return null; | ||
} | ||
rgb = rgb.map(_ => { | ||
_ = _ / 255; | ||
if (_ < 0.03928) { | ||
_ = _ / 12.92; | ||
} else { | ||
_ = (_ + .055) / 1.055; | ||
_ = Math.pow(_, 2.4); | ||
} | ||
return _; | ||
}); | ||
return 0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2]; | ||
} | ||
}; | ||
export default ColorUtil; |
Oops, something went wrong.