Skip to content

Commit

Permalink
Updated StrokeColorFromFill.jsx
Browse files Browse the repository at this point in the history
Shifting lightness to white keeps spot swatches
  • Loading branch information
creold committed Feb 12, 2024
1 parent d380fe6 commit 211982f
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 12 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ Click the category name to learn more about the scripts in the selected category
* [MatchColors](https://github.com/creold/illustrator-scripts/blob/master/md/Color.md#matchcolors) `new, 22.12.2023`
* [RemoveGradientStops](https://github.com/creold/illustrator-scripts/blob/master/md/Color.md#removegradientstops)
* [ReverseGradientColor](https://github.com/creold/illustrator-scripts/blob/master/md/Color.md#reversegradientcolor)
* [StrokeColorFromFill](https://github.com/creold/illustrator-scripts/blob/master/md/Color.md#strokecolorfromfill) `upd, 09.02.2024`
* [StrokeColorFromFill](https://github.com/creold/illustrator-scripts/blob/master/md/Color.md#strokecolorfromfill) `upd, 12.02.2024`

### [Draw](md/Draw.md)

Expand Down
2 changes: 1 addition & 1 deletion README.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
* [MatchColors](https://github.com/creold/illustrator-scripts/blob/master/md/Color.ru.md#matchcolors) `new, 22.12.2023`
* [RemoveGradientStops](https://github.com/creold/illustrator-scripts/blob/master/md/Color.ru.md#removegradientstops)
* [ReverseGradientColor](https://github.com/creold/illustrator-scripts/blob/master/md/Color.ru.md#reversegradientcolor)
* [StrokeColorFromFill](https://github.com/creold/illustrator-scripts/blob/master/md/Color.ru.md#strokecolorfromfill) `upd, 09.02.2024`
* [StrokeColorFromFill](https://github.com/creold/illustrator-scripts/blob/master/md/Color.ru.md#strokecolorfromfill) `upd, 12.02.2024`

### [Draw](md/Draw.ru.md)
Скрипты, которые что-либо рисуют
Expand Down
22 changes: 18 additions & 4 deletions jsx/StrokeColorFromFill.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
Installation: https://github.com/creold/illustrator-scripts#how-to-run-scripts
Release notes:
0.4.1 Shifting lightness to white keeps spot swatches
0.4 Changed color shift method. Spot conversion always.
Fixed bug with strokes on Mac OS. Added weight input for new strokes.
Minor improvements
Expand Down Expand Up @@ -42,7 +43,7 @@ app.preferences.setBooleanPreference('ShowExternalJSXWarning', false); // Fix dr
function main() {
var SCRIPT = {
name: 'Stroke Color From Fill',
version: 'v0.4'
version: 'v0.4.1'
},
CFG = {
aiVers: parseFloat(app.version),
Expand Down Expand Up @@ -89,8 +90,8 @@ function main() {
win.alignChildren = ['fill', 'center'];
win.opacity = CFG.uiOpacity;

// Brightness
var shiftPnl = win.add('panel', undefined, 'Shift Brightness');
// Lightness
var shiftPnl = win.add('panel', undefined, 'Shift Ligthness');
shiftPnl.orientation = 'row';
shiftPnl.alignChildren = ['left', 'center'];
shiftPnl.margins = [10, 15, 10, 8];
Expand Down Expand Up @@ -439,7 +440,20 @@ function calcColor(color, value, keys, isRgb) {

// Process Spot
if (currColor.typename === 'SpotColor') {
currColor = getSpotTint(currColor, isRgb);
if (value < 0) {
currColor = getSpotTint(currColor, isRgb);
} else {
_stroke = new SpotColor();
_stroke.spot = currColor.spot;

var tint = currColor.tint;

tint = tint * (1 - value / 100);
tint = clamp(tint, 0, 100);
_stroke.tint = Math.round(tint);

return _stroke;
}
}

// Process Grayscale
Expand Down
6 changes: 3 additions & 3 deletions md/Color.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* [MatchColors](https://github.com/creold/illustrator-scripts/blob/master/md/Color.md#matchcolors) `new, 22.12.2023`
* [RemoveGradientStops](https://github.com/creold/illustrator-scripts/blob/master/md/Color.md#removegradientstops)
* [ReverseGradientColor](https://github.com/creold/illustrator-scripts/blob/master/md/Color.md#reversegradientcolor)
* [StrokeColorFromFill](https://github.com/creold/illustrator-scripts/blob/master/md/Color.md#strokecolorfromfill) `upd, 09.02.2024`
* [StrokeColorFromFill](https://github.com/creold/illustrator-scripts/blob/master/md/Color.md#strokecolorfromfill) `upd, 12.02.2024`

## AverageColors
[![Direct](https://img.shields.io/badge/Direct%20Link-AverageColors.jsx-FF6900.svg)](https://rebrand.ly/avgcols) [![Download](https://img.shields.io/badge/Download%20All-Zip%20archive-0088CC.svg)](https://bit.ly/2M0j95N)
Expand Down Expand Up @@ -145,9 +145,9 @@ Reverse the order of gradient colors and their opacity. Does not reverse the loc
## StrokeColorFromFill
[![Direct](https://img.shields.io/badge/Direct%20Link-StrokeColorFromFill.jsx-FF6900.svg)](https://rebrand.ly/strokefromfill) [![Download](https://img.shields.io/badge/Download%20All-Zip%20archive-0088CC.svg)](https://bit.ly/2M0j95N)

Setting the Stroke color of object based on an his solid or gradient fill. The option to automatically add an stroke is not available for Mac OS users with an Illustrator older than CC 2020.
Applies a color from its solid or gradient fill to the stroke of each selected path. If the fill is a gradient, the colors of all gradient stops are averaged for the stroke color.

![StrokeColorFromFill](https://i.ibb.co/8dtK1V3/demo-Stroke-Color-From-Fill.gif)
![StrokeColorFromFill](https://i.ibb.co/dkW64ZV/Stroke-Color-From-Fill.gif)

## Donate
Many scripts are free to download thanks to user support. Help me to develop new scripts and update existing ones by supporting my work with any amount via [Buymeacoffee], [Tinkoff], [ЮMoney], [Donatty], [DonatePay]. Thank you.
Expand Down
6 changes: 3 additions & 3 deletions md/Color.ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* [MatchColors](https://github.com/creold/illustrator-scripts/blob/master/md/Color.ru.md#matchcolors) `new, 22.12.2023`
* [RemoveGradientStops](https://github.com/creold/illustrator-scripts/blob/master/md/Color.ru.md#removegradientstops)
* [ReverseGradientColor](https://github.com/creold/illustrator-scripts/blob/master/md/Color.ru.md#reversegradientcolor)
* [StrokeColorFromFill](https://github.com/creold/illustrator-scripts/blob/master/md/Color.ru.md#strokecolorfromfill) `upd, 09.02.2024`
* [StrokeColorFromFill](https://github.com/creold/illustrator-scripts/blob/master/md/Color.ru.md#strokecolorfromfill) `upd, 12.02.2024`

## AverageColors
[![Direct](https://img.shields.io/badge/Прямая%20ссылка-AverageColors.jsx-FF6900.svg)](https://rebrand.ly/avgcols) [![Download](https://img.shields.io/badge/Скачать%20все-Zip--архив-0088CC.svg)](https://bit.ly/2M0j95N)
Expand Down Expand Up @@ -145,9 +145,9 @@
## StrokeColorFromFill
[![Direct](https://img.shields.io/badge/Прямая%20ссылка-StrokeColorFromFill.jsx-FF6900.svg)](https://rebrand.ly/strokefromfill) [![Download](https://img.shields.io/badge/Скачать%20все-Zip--архив-0088CC.svg)](https://bit.ly/2M0j95N)

Присваивает обводке (Stroke) каждого выбранного объекта цвет из его сплошной или градиентной заливки. Опция автоматического добавления обводки объекту недоступна на Mac OS с Illustrator ниже CC 2020.
Применяет к обводке (Stroke) каждого выбранного объекта цвет из его сплошной или градиентной заливки. Если заливка градиентная, то цвета всех стопов градиента усредняются для цвета обводки.

![StrokeColorFromFill](https://i.ibb.co/8dtK1V3/demo-Stroke-Color-From-Fill.gif)
![StrokeColorFromFill](https://i.ibb.co/dkW64ZV/Stroke-Color-From-Fill.gif)

## Поддержка
Многие скрипты бесплатны для скачивания благодаря поддержке пользователей. Помогите продолжать разработку новых и обновление текущих скриптов, поддержав мою работу любой суммой через [Buymeacoffee] (иностр. карты), [Tinkoff], [ЮMoney], [Donatty], [DonatePay]. Спасибо.
Expand Down

0 comments on commit 211982f

Please sign in to comment.