Change a filename's text colour?

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
cottage-r
Posts: 6
Joined: 21 Apr 2015 18:33

Change a filename's text colour?

Post by cottage-r »

In Details view, I'd like to change the text colour of any filename on an ad hoc individual basis. Ideally via context menu, or else by clicking a toolbar button once a file (or batch of files) is selected/highlighted.

Not create an extra column for tags or labels, nor add a background colour behind the filename, but only alter the text/font colour of any filename(s) as and where required, on the fly.

Is this possible?
Apologies, I'm afraid I got a little bogged down in the help about color filtering, but didn't see anything that seemed to do this? I'm not sure a filter would work anyway, as there would be no set patterns, properties or file attributes.

highend
Posts: 15004
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Change a filename's text colour?

Post by highend »

Sure it is

E.g.:

Code: Select all

    $color = "FB4F04";
    $filter = regexreplace(<get SelectedItemsNames <crlf>>, "^(.+?)(?=\r?\n|$)", "L:name:$1>$color");
    colorfilter($filter, <crlf>);
One of my scripts helped you out? Please donate via Paypal

cottage-r
Posts: 6
Joined: 21 Apr 2015 18:33

Re: Change a filename's text colour?

Post by cottage-r »

Great! And thank you.

But I'm embarrassed to say I don't know how to make or use a script. I see examples in the help topic but don't know how/where to begin, sorry. Could you teach an old dog a new trick, and possibly walk me through the steps? And can I make a toolbar button with a choice of various colours (as there is, say, with the 'Select Label' button). The one thing I'm OK with is Hex color codes... it's all the rest I don't know how to do :oops:

highend
Posts: 15004
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Change a filename's text colour?

Post by highend »

Type

Code: Select all

snippet;
in the address bar and execute it with the enter key
In the new window that appears, paste this code:

Code: Select all

Snip: CTB 1
  XYplorer 18.60.0007, 12.01.2018 19:12:36
Action
  NewUserButton
Name
  Colorize
Icon
  :tsf
ScriptL
  $colorList = "BlueViolet;8A2BE2|NavyBlue;000080|Brown;A52A2A|DarkGreen;006400|-|Black;000000";
  
      $color = popupmenu($colorList);
      $filter = regexreplace(<get SelectedItemsNames <crlf>>, "^(.+?)(?=\r?\n|$)", "L:name:$1>$color");
      colorfilter($filter, <crlf>);
  
ScriptR
  
FireClick
  0
New toolbar button appears...
One of my scripts helped you out? Please donate via Paypal

cottage-r
Posts: 6
Joined: 21 Apr 2015 18:33

Re: Change a filename's text colour?

Post by cottage-r »

Hi - many thanks for the help, and sorry for delay coming back.

I now have the new button :)

But two things...

(1) When I select/highlight a file (let's say zzz.jpg), click the button and choose one of the colors you've set up, a message comes up in the bottom status bar saying:
Instant Color Filter applied: L:name:zzz.jpg
but the text of the selected file doesn't change and stays black. Where am I going wrong? Or I wondered if I need to update XYplorer for it to work? -- I'm using v15.

(2) If I want to add another color choice, I think I could now follow the syntax of what you have kindly passed on, but just wanted to check if a color name must be used (as you have done) as well as a HEX value? In other words, I can't use any HEX value on its own that I take a fancy to: it must be one of the recognized named colors?

highend
Posts: 15004
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Change a filename's text colour?

Post by highend »

1. v15 doesn't know anything about scope selection (this was implemented later), so just remove the

Code: Select all

L:
in

Code: Select all

"L:name:$1>$color"
2. No, you can just use the hex values if you want but for most people looking at a menu item entry
name in hex, the value doesn't translate to the belonging color very well. That's why I used named
menu entries here
One of my scripts helped you out? Please donate via Paypal

highend
Posts: 15004
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Change a filename's text colour?

Post by highend »

Or maybe something like this:

Code: Select all

    $dll = "<some path>\Icons_Colors_16.dll";
    $colorList = "FF0000;FF0000;$dll /3|0000FF;0000FF;$dll /5|FFFF00;FFFF00;$dll /6|008000;008000;$dll /13|-|000000;000000;$dll /1";

    $color = popupmenu($colorList);
    $filter = regexreplace(<get SelectedItemsNames <crlf>>, "^(.+?)(?=\r?\n|$)", "L:name:$1>$color");
    colorfilter($filter, <crlf>);
Icons_Colors_16.zip
Ofc the path needs to be adapted and the .dll from the .zip file put into that...

Would look like:
colorized.png
The 16er .dll contains these colored icons:

Code: Select all

01. Black #000000.ico
02. White #FFFFFF.ico
03. Red #FF0000.ico
04. Lime #00FF00.ico
05. Blue #0000FF.ico
06. Yellow #FFFF00.ico
07. Cyan #00FFFF.ico
08. Magenta #FF00FF.ico
09. Silver #C0C0C0.ico
10. Gray #808080.ico
11. Maroon #800000.ico
12. Olive #808000.ico
13. Green #008000.ico
14. Purple #800080.ico
15. Teal #008080.ico
16. Navy #000080.ico
Icons_Colors_139.zip
The 139er .dll contains these icons:

Code: Select all

001. Maroon #800000.ico
002. Dark Red #8B0000.ico
003. Brown #A52A2A.ico
004. Firebrick #B22222.ico
005. Crimson #DC143C.ico
006. Red #FF0000.ico
007. Tomato #FF6347.ico
008. Coral #FF7F50.ico
009. Indian Red #CD5C5C.ico
010. Light Coral #F08080.ico
011. Dark Salmon #E9967A.ico
012. Salmon #FA8072.ico
013. Light Salmon #FFA07A.ico
014. Orange Red #FF4500.ico
015. Dark Orange #FF8C00.ico
016. Orange #FFA500.ico
017. Gold #FFD700.ico
018. Dark Golden Rod #B8860B.ico
019. Golden Rod #DAA520.ico
020. Pale Golden Rod #EEE8AA.ico
021. Dark Khaki #BDB76B.ico
022. Khaki #F0E68C.ico
023. Olive #808000.ico
024. Yellow #FFFF00.ico
025. Yellow Green #9ACD32.ico
026. Dark Olive Green #556B2F.ico
027. Olive Drab #6B8E23.ico
028. Lawn Green #7CFC00.ico
029. Chart Reuse #7FFF00.ico
030. Green Yellow #ADFF2F.ico
031. Dark Green #006400.ico
032. Green #008000.ico
033. Forest Green #228B22.ico
034. Lime #00FF00.ico
035. Lime Green #32CD32.ico
036. Light Green #90EE90.ico
037. Pale Green #98FB98.ico
038. Dark Sea Green #8FBC8F.ico
039. Medium Spring Green #00FA9A.ico
040. Spring Green #00FF7F.ico
041. Sea Green #2E8B57.ico
042. Medium Aqua Marine #66CDAA.ico
043. Medium Sea Green #3CB371.ico
044. Light Sea Green #20B2AA.ico
045. Dark Slate Gray #2F4F4F.ico
046. Teal #008080.ico
047. Dark Cyan #008B8B.ico
048. Aqua #00FFFF.ico
049. Cyan #00FFFF.ico
050. Light Cyan #E0FFFF.ico
051. Dark Turquoise #00CED1.ico
052. Turquoise #40E0D0.ico
053. Medium Turquoise #48D1CC.ico
054. Pale Turquoise #AFEEEE.ico
055. Aqua Marine #7FFFD4.ico
056. Powder Blue #B0E0E6.ico
057. Cadet Blue #5F9EA0.ico
058. Steel Blue #4682B4.ico
059. Corn Flower Blue #6495ED.ico
060. Deep Sky Blue #00BFFF.ico
061. Dodger Blue #1E90FF.ico
062. Light Blue #ADD8E6.ico
063. Sky Blue #87CEEB.ico
064. Light Sky Blue #87CEFA.ico
065. Midnight Blue #191970.ico
066. Navy #000080.ico
067. Dark Blue #00008B.ico
068. Medium Blue #0000CD.ico
069. Blue #0000FF.ico
070. Royal Blue #4169E1.ico
071. Blue Violet #8A2BE2.ico
072. Indigo #4B0082.ico
073. Dark Slate Blue #483D8B.ico
074. Slate Blue #6A5ACD.ico
075. Medium Slate Blue #7B68EE.ico
076. Medium Purple #9370DB.ico
077. Dark Magenta #8B008B.ico
078. Dark Violet #9400D3.ico
079. Dark Orchid #9932CC.ico
080. Medium Orchid #BA55D3.ico
081. Purple #800080.ico
082. Thistle #D8BFD8.ico
083. Plum #DDA0DD.ico
084. Violet #EE82EE.ico
085. Magenta #FF00FF.ico
086. Orchid #DA70D6.ico
087. Medium Violet Red #C71585.ico
088. Pale Violet Red #DB7093.ico
089. Deep Pink #FF1493.ico
090. Hot Pink #FF69B4.ico
091. Light Pink #FFB6C1.ico
092. Pink #FFC0CB.ico
093. Antique White #FAEBD7.ico
094. Beige #F5F5DC.ico
095. Bisque #FFE4C4.ico
096. Blanched Almond #FFEBCD.ico
097. Wheat #F5DEB3.ico
098. Corn Silk #FFF8DC.ico
099. Lemon Chiffon #FFFACD.ico
100. Light Golden Rod Yellow #FAFAD2.ico
101. Light Yellow #FFFFE0.ico
102. Saddle Brown #8B4513.ico
103. Sienna #A0522D.ico
104. Chocolate #D2691E.ico
105. Peru #CD853F.ico
106. Sandy Brown #F4A460.ico
107. Burly Wood #DEB887.ico
108. Tan #D2B48C.ico
109. Rosy Brown #BC8F8F.ico
110. Moccasin #FFE4B5.ico
111. Navajo White #FFDEAD.ico
112. Peach Puff #FFDAB9.ico
113. Misty Rose #FFE4E1.ico
114. Lavender Blush #FFF0F5.ico
115. Linen #FAF0E6.ico
116. Old Lace #FDF5E6.ico
117. Papaya Whip #FFEFD5.ico
118. Sea Shell #FFF5EE.ico
119. Mint Cream #F5FFFA.ico
120. Slate Gray #708090.ico
121. Light Slate Gray #778899.ico
122. Light Steel Blue #B0C4DE.ico
123. Lavender #E6E6FA.ico
124. Floral White #FFFAF0.ico
125. Alice Blue #F0F8FF.ico
126. Ghost White #F8F8FF.ico
127. Honeydew #F0FFF0.ico
128. Ivory #FFFFF0.ico
129. Azure #F0FFFF.ico
130. Snow #FFFAFA.ico
131. Black #000000.ico
132. Dim Grey #696969.ico
133. Grey #808080.ico
134. Dark Grey #A9A9A9.ico
135. Silver #C0C0C0.ico
136. Light Grey #D3D3D3.ico
137. Gainsboro #DCDCDC.ico
138. White Smoke #F5F5F5.ico
139. White #FFFFFF.ico
To see the attached files, you need to log into the forum.
One of my scripts helped you out? Please donate via Paypal

jupe
Posts: 3478
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Change a filename's text colour?

Post by jupe »

@highend that is an awesome setup you have provided with the compact icon .dll file.

A site I found useful as well if the OP wants fully custom icon colors is https://www.iconsdb.com/ because you can just put in the hex code and it creates downloadable icons for you that you can have in different shapes etc.

highend
Posts: 15004
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Change a filename's text colour?

Post by highend »

It isn't so compact once you've extracted the .zip file :mrgreen:
But ofc the color depth could be reduced to reduce the overall .dll size...
Yeah, really a nice one. Thanks for the link, I can use this myself!
One of my scripts helped you out? Please donate via Paypal

BobCrash
Posts: 33
Joined: 15 Sep 2017 03:17

Re: Change a filename's text colour?

Post by BobCrash »

Well.

Highend and Jupe... you guys are always handing out the cool candy tips. This one is great.

Thanks to you both.

Post Reply