Gradient text tester
I'm seeing if I can maniplate a percentage and a loop field.
So far it seems to be working.
I can also get a gray gradient.
And a cyan colored one too!
I also got this weird inverted one.
Text Gradient tester.
Started by
gamax92
, Mar 11 2012 03:23 AM
11 replies to this topic
#1
Posted 11 March 2012 - 03:23 AM
#2
Posted 11 March 2012 - 04:02 AM
Wow cool!! 8)
#3
Posted 11 March 2012 - 04:20 AM
Do share!
#4
Posted 11 March 2012 - 05:00 AM
String =
(
Place strings here.
They will become gradients!
)
Loop, parse, String, `n, `r
{
SubString := A_LoopField
Loop, % StrLen(SubString)
{
SetFormat, Float, 100.100
Percentage := A_Index/StrLen(SubString)
SetFormat, Float, 3.0
; Mess with these values, they produce cool gradients
R := 255 - (255 * Percentage)
G := 255
B := 0
SetFormat, Float, 100.100
Encoded .= "[color=#" . RGB2HEX(R . "|" . G . "|" . B, "|") . "]" . SubStr(SubString,A_Index,1) . "[/color]"
}
Encoded .= "`r`n"
}
StringTrimRight, Encoded, Encoded, 2
Clipboard := Encoded
ExitApp
Return
;Credit goes to SKAN for this.
RGB2HEX(RGBString,Delimiter="")
{
If Delimiter=
Delimiter=,
StringSplit,_RGB,RGBString,%Delimiter%
SetFormat, Integer, Hex
_RGB1+=0
_RGB2+=0
_RGB3+=0
If StrLen(_RGB1) = 3
_RGB1= 0%_RGB1%
If StrLen(_RGB2) = 3
_RGB2= 0%_RGB2%
If StrLen(_RGB3) = 3
_RGB3= 0%_RGB3%
SetFormat, Integer, D
HEXString = % _RGB1 _RGB2 _RGB3
StringReplace, HEXString, HEXString,0x,,All
StringUpper, HEXString, HEXString
Return, HEXString
}
#5
Posted 11 March 2012 - 07:03 AM
Place strings here.
They will become gradients!
They will become gradients!
#6
Posted 11 March 2012 - 07:09 AM
That is cool. I like it.
Thanks.
#7
Posted 11 March 2012 - 03:36 PM
Related: PhiLho's Version <!-- m -->http://www.autohotke... ... 0308#60308<!-- m -->
#8
Posted 12 March 2012 - 08:08 PM
Cool!
I can't get PhiLho's version to work with AHK_L.
I can't get PhiLho's version to work with AHK_L.
#9
Posted 12 March 2012 - 09:22 PM
Here's a re-write of PhiLho's function compatible with AHK_L:
Escape::
Clipboard := GradientText(Clipboard)
return
GradientText(text) {
rgb := []
Loop, 6
{
Random, out, % (A_Index < 4) ? 50 : -10, % (A_Index < 4) ? 240 : 10
rgb.Insert(out)
}
Loop, parse, text
{
if (A_LoopField~="\S")
{
For i, c in rgb
d := rgb[i + 3], rgb[i] += (c + d < 0 || c + d > 255) ? (-d) : d
Until (i=3)
orig := A_FormatInteger
SetFormat, Integer, Hex
gradientText .= "[color=#" SubStr(0x1000000 + (rgb[1] << 16) + (rgb[2] << 8) + rgb[3],4) "]" A_LoopField "[/color]"
SetFormat, Integer, %orig%
}
else gradientText .= A_LoopField
}
return gradientText
}
#10
Posted 12 March 2012 - 10:00 PM
Nice work, sinkfaze! This version is fairly interesting... it'll take me a few minutes to understand it!
gamax92's script seems to follow a slightly different method.
gamax92's script seems to follow a slightly different method.
#11
Posted 13 March 2012 - 01:18 PM
Thanks, sinkfaze! Works quite nicely now...Here's a re-write of PhiLho's function compatible with AHK_L:...
#12
Posted 13 March 2012 - 03:10 PM
I made what should've been a rather obvious change in the function to allow it to skip any whitespace and not just spaces. I also simplified the internal math with a for-loop.




