Jump to content

FONT COLOR??


tylerh27
 Share

Recommended Posts

I'm going to be getting text from a web server, and i'll receive something like: <font color="green">Username:</font> string for message

Anyway, i wanna i wanna string replace the font tags, and make the actual text "Username" green when its displayed, but idk how to change colors.

It will also be in an edit box "GuiCtrlCreateEdit"

Can someone tell me how to make certain text green?

Link to comment
Share on other sites

you could either create an array with the hex color and assign the word to a number

say:

Dim $color_array[3]

$color_array[0] = 0x00FF00

$color_array[1] = 0x0000FF

$color_array[2] = 0xFF0000

*edit*

a better way to write the array:

Local $color_array[3] = [0x00FF00,0x0000FF,0xFF0000]

*end edit*

then get your text from the web page and search for the color

if $color = "green" then

$i = 0

elseif $color = "blue" then

$i = 1

elseif $color = "red" then

$i = 2

etc.

then you can use

GUICtrlSetColor($Handle_to_Text, $color_array[$i])

Edited by kaotkbliss

010101000110100001101001011100110010000001101001011100110010000

001101101011110010010000001110011011010010110011100100001

My Android cat and mouse game
https://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek

We're gonna need another Timmy!

Link to comment
Share on other sites

Hi,

Here you go :

#include <Array.au3>

ConsoleWrite("red: " & _HTMLColorToHex("red") & @CRLF) ;decimal
ConsoleWrite("red: 0x" & Hex(_HTMLColorToHex("red"), 6) & @CRLF) ;hex

;the hex color written in the array is converted to decimal

Func _HTMLColorToHex($sHTMLColorToHex_HTMLColor)
Local $aHTMLColorToHex_Color[3][2] = [ _ ;Don't forget to edit the size of the array
[0xFF0000, "red"], _
[0xFFFFFF, "white"], _
[0x000000, "black"]] ;and so on

Local $iHTMLColorToHex_ColorIndex = _ArraySearch($aHTMLColorToHex_Color, $sHTMLColorToHex_HTMLColor, 0, 0, 0, 0, 1, 1)

If $iHTMLColorToHex_ColorIndex <> -1 Then
Return $aHTMLColorToHex_Color[$iHTMLColorToHex_ColorIndex][0]
Else
Return -1
EndIf
EndFunc   ;==>_HTMLColorToHex

Br, FireFox.

Edited by FireFox
Link to comment
Share on other sites

Can someone tell me how to make certain text green?

Just making certain text of specific color is not possible in Edit controls

U should use RichEdit controls

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...