diff --git a/pywsjtx/qcolor.py b/pywsjtx/qcolor.py index 98eb615..80d18e7 100644 --- a/pywsjtx/qcolor.py +++ b/pywsjtx/qcolor.py @@ -7,18 +7,19 @@ class QCOLOR: def __init__(self, spec, alpha, red, green, blue): self.spec = spec - self.red = alpha - self.green = red - self.blue = green - self.alpha = blue + self.red = red + self.green = green + self.blue = blue + self.alpha = alpha @classmethod def Black(cls): - return QCOLOR(QCOLOR.SPEC_RGB, 255, 0, 0,0) + return QCOLOR(QCOLOR.SPEC_RGB, 255, 0, 0, 0) @classmethod def Red(cls): return QCOLOR(QCOLOR.SPEC_RGB, 255, 255, 0, 0) + @classmethod def RGBA(cls, alpha, red, green, blue): return QCOLOR(QCOLOR.SPEC_RGB, alpha, red, green, blue) @@ -27,4 +28,8 @@ class QCOLOR: def White(cls): return QCOLOR(QCOLOR.SPEC_RGB, 255,255,255,255) + @classmethod + def Uncolor(cls): + return QCOLOR(QCOLOR.SPEC_INVALID, 0,0,0,0) + diff --git a/samples/color_wsjtx_packets.py b/samples/color_wsjtx_packets.py index f4b0159..3d4e7e8 100644 --- a/samples/color_wsjtx_packets.py +++ b/samples/color_wsjtx_packets.py @@ -36,11 +36,17 @@ while True: callsign = m.group(1) color_pkt = pywsjtx.HighlightCallsignPacket.Builder(the_packet.wsjtx_id, callsign, - pywsjtx.QCOLOR.RGBA(255,random.randint(0,255),random.randint(0,255),random.randint(0,255)), - pywsjtx.QCOLOR.RGBA(255,random.randint(0,255),random.randint(0,255),random.randint(0,255)), + + pywsjtx.QCOLOR.Red(), + pywsjtx.QCOLOR.White(), + True) + + normal_pkt = pywsjtx.HighlightCallsignPacket.Builder(the_packet.wsjtx_id, callsign, + pywsjtx.QCOLOR.Uncolor(), + pywsjtx.QCOLOR.Uncolor(), True) s.send_packet(addr_port, color_pkt) - print(pywsjtx.PacketUtil.hexdump(color_pkt)) + #print(pywsjtx.PacketUtil.hexdump(color_pkt)) print(the_packet)