Comments (3)
That's very kind of you, thank you for that and for this amazing powerhouse of an extension!
from vscode-swissknife.
Just to give you an update I'm working on it...
I will only implement a single convertion for HSL and HWB.
Otherwise I would need to implement all possible combinations like HEX to HSL, RGB to HSL, HWB to HSL, etc. And that would be a bit noisy in the menu section
You can always invoke multiple scripts to go from the format you have to the format you need. Also you can create user scripts to do conversions directly from the ones you need, just by invoking the native conversion methods. I'll provide you with a working example for that when I close this one :)
from vscode-swissknife.
Sorry for the late reply... I've been focusing on other projects...
Anyway, this is now done and released in 1.8.1
The conversions are to and from Hex (hsl to hex, hex to hsl, etc) otherwise I would end up creating a lot of scripts to cover all possible combinations.
If you want a specific combination you can create your own custom script to achieve this...
Take a look on how to create custom scripts here
Also, I'll leave here the code to do a custom script to do HSL to HWB, in case it helps:
Object.defineProperty(exports, "__esModule", { value: true });
exports.hslToHwb = async (text) => {
}
const scripts = [
{
title: "HSL to HWB",
detail: "Convert HSL color to HWB",
cb: (context) => {
const hslToHwb = async (text) => {
const res = text.match(/hsl\((\d+),\s*(\d+)%,\s*(\d+)%\)?/)
if (!res) {
context.informationRoutine(async () => "Invalid HSL Format")
return text
}
res.shift()
const [h, s, l] = res.map(Number)
const hex = context.modules.colors.hslToHex(h, s, l)
const hwb = context.modules.colors.hexToHwb(hex)
return Promise.resolve(hwb)
}
return context.replaceRoutine(hslToHwb)
}
}
]
exports.default = scripts;
Also, for reference, the variable context.modules holds a variable for each file in the lib folder and the methods for each are the same you can find in those files :)
from vscode-swissknife.
Related Issues (13)
- [Suggestion] - Add the ability to replace the whole RGB color in hex HOT 8
- Publish extension on Open-VSX for VScodium HOT 1
- Feature: Custom Decorators - show decorators on the directory if the file is decorated inside of it HOT 2
- No log to output window from HTTP server HOT 2
- Shortcut for MD5? HOT 1
- history comment lost HOT 1
- Bug Report: Decorate File/Folder Not Working
- Undo behavior HOT 6
- Extension host terminated unexpectedly HOT 5
- Multi-cursor "lorem ipsum" generation is broken HOT 2
- [SUGGESTION] RGBA conversion HOT 3
- Bug in RGB→HEX conversion
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vscode-swissknife.