Re: How to set green color in Terminal.app to a specific color code?
Re: How to set green color in Terminal.app to a specific color code?
- Subject: Re: How to set green color in Terminal.app to a specific color code?
- From: Takaaki Naganoya <email@hidden>
- Date: Tue, 06 Feb 2018 15:53:10 +0900
How about make a color-name —> color value table by yourself?
<AppleScript>
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use framework "AppKit"
set ansiColTable to {{colName:"Green", colVal:{0, 53713, 0}}, {colName:"Red",
colVal:{38937, 0, 710}}, {colName:"Blue", colVal:{0, 0, 39429}}}
set aRes to filterListUsingPredicate(ansiColTable, "colName ==[c] %@", "Blue")
if aRes = missing value then return
set colList to colVal of aRes
tell application "Terminal" to set normal text color of window 1 to colList
on filterListUsingPredicate(aList as list, aPredicateStr as string, targStr as
string)
set setKey to current application's NSMutableSet's setWithArray:aList
set aPredicate to current application's NSPredicate's
predicateWithFormat_(aPredicateStr, targStr)
set aRes to (setKey's filteredSetUsingPredicate:aPredicate)
return (aRes's allObjects()) as list of string or string
end filterListUsingPredicate
</AppleScript>
> 2018/02/04 10:12、Peng Yu <email@hidden>のメール:
>
> Hi,
>
> I can set the normal text color to a specific color code.
>
> tell application "Terminal" to set normal text color of window 1 to
> {0, 53713, 0}
>
> But I want set the green color (used by ANSI-color) in Terminal to {0,
> 53713, 0}. Does anybody know how to do it with applescript? Thanks.
>
> https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
>
> --
> Regards,
> Peng
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
--
Takaaki Naganoya
email@hidden
http://piyocast.com/as/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden