mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2026-08-20 17:58:54 +00:00
Add expertimental colour-oklch operator
This commit is contained in:
@@ -14,14 +14,23 @@ Filter operators for colour operations
|
||||
|
||||
var Color = require("$:/core/modules/utils/dom/color.js").Color;
|
||||
|
||||
exports["colour-lighten"] = makeColourOperator(function (c, operator, operands) {
|
||||
exports["colour-lighten"] = makeColourOperator(function (c, operator, options) {
|
||||
return c.lighten($tw.utils.parseNumber(operator.operand));
|
||||
});
|
||||
|
||||
exports["colour-darken"] = makeColourOperator(function (c, operator, operands) {
|
||||
exports["colour-darken"] = makeColourOperator(function (c, operator, options) {
|
||||
return c.darken($tw.utils.parseNumber(operator.operand));
|
||||
});
|
||||
|
||||
exports["colour-oklch"] = makeColourOperator(function (c, operator, options) {
|
||||
var prop = ((operator.suffixes || [])[0] || ["l"])[0];
|
||||
console.log("Prop",prop,$tw.utils.parseNumber(operator.operand))
|
||||
if(["l","c","h"].indexOf(prop) !== -1) {
|
||||
c.oklch[prop] = $tw.utils.parseNumber(operator.operand);
|
||||
}
|
||||
return c;
|
||||
});
|
||||
|
||||
function makeColourOperator(fn) {
|
||||
return function (source, operator, options) {
|
||||
var results = [];
|
||||
|
||||
Reference in New Issue
Block a user