一个关于颜色的小问题,大家讨论!在线等待。。

时间:2022-06-30 17:36:37
介绍rgb()函数时最亮颜色值是白色,其长整数值为16777215(65536*255+256*255+255)。然而窗口默认的背景色灰色颜色值却是
67108864。这个值是怎么算出来的?我要用rgb()来表示应该怎么表示呢?
我真得很纳闷。现在我想让一个自定义对象的颜色与窗口的背景色一致,
那么我应该设置什么颜色值才能实现呢?各位请帮帮忙,在线等待!!

6 个解决方案

#1


用BottonFace即可实现与窗口的背景色一致.

#2


Light Gray 192 192 192
Dark Gray          128          128          128

#3


就像进制转换一样,可以作为256进制转换,一共三位就是rgb的三个参数,其实没有必要,rgb就是要转换成颜色,既然已经知道颜色值,可以直接使用,还不用再rgb转换了。

#4


给你一个SRD
这是以前LIULEE老大给我的
里面说明了各种系统颜色的编码
很有加值的

太长了
分成了两部分,你把他们合并起来就能用了


$PBExportHeader$d_rgb_color_calculater.srd
release 7;
datawindow(units=0 timer_interval=0 color=16777215 processing=1 HTMLDW=no print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no grid.lines=0 grid.columnmove=no selected.mouse=no )
header(height=72 color="0" )
summary(height=0 color="536870912" )
footer(height=0 color="536870912" )
detail(height=84 color="0~tif (c_name = 'TextColor',rgb(255,255,255),0)" )
table(column=(type=char(30) updatewhereclause=no name=c_name dbname="c_name" )
 column=(type=number updatewhereclause=no name=c_red dbname="c_red" initial="0" )
 column=(type=number updatewhereclause=no name=c_green dbname="c_green" initial="0" )
 column=(type=number updatewhereclause=no name=c_blue dbname="c_blue" initial="0" )
 column=(type=number updatewhereclause=no name=rgb_num dbname="rgb_num" )
 )
data("White", 255, 255, 255, 16777215,"Red", 255, 0, 0, 255,"Blue", 0, 0, 255, 16711680,"Green", 0, 255, 0, 65280,"Light Gray", 192, 192, 192, 12632256,"Dark Gray    ", 128, 128, 128, 8421504,"Dark Red", 128, 0, 0, 128,"Dark Green", 0, 128, 0, 32768,"Dark Blue    ", 0, 0, 128, 8388608,"Magenta", 255, 0, 255, 16711935,"Dark Magenta", 128, 0, 128, 8388736,"Cyan", 0, 255, 255, 16776960,"Dark Cyan", 0, 128, 128, 8421376,"Yellow    ", 255, 255, 0, 65535,"Brown", 128, 128, 0, 32896,"TextColor",null null null  33554432,"AppColor",null null null  276856960,"Transparent",null null null  553648127,"ButtonFace",null null null  80269524,"WndBKRnd",null null null  1090519039,"Color1", 239, 239, 223, 14675951,"color2", 217, 214, 168, 11065049,"LightYellow", 239, 216, 144, 9492719,null  214, 221, 198, 12771542,null  229, 229, 213, 14018021,null  219, 219, 203, 13360091,) 
text(band=header alignment="2" text="Color Name" border="0" color="16777215" x="9" y="8" height="60" width="457"  name=t_2  font.face="Tahoma" font.height="-8" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="Red" border="0" color="1090519039" x="475" y="8" height="60" width="151"  name=c_red_t  font.face="Tahoma" font.height="-8" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="255" )
text(band=header alignment="2" text="Green" border="0" color="33554432" x="635" y="8" height="60" width="137"  name=c_green_t  font.face="Tahoma" font.height="-8" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="65280" )
text(band=header alignment="2" text="Blue" border="0" color="15793151" x="782" y="8" height="60" width="160"  name=c_blue_t  font.face="Tahoma" font.height="-8" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="16711680" )
text(band=header alignment="2" text="Red" border="0" color="15793151" x="1906" y="8" height="60" width="146"  name=t_4  font.face="Tahoma" font.height="-8" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="255" )
text(band=header alignment="2" text="Green" border="0" color="33554432" x="2062" y="8" height="60" width="142"  name=t_5  font.face="Tahoma" font.height="-8" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="65280" )
text(band=header alignment="2" text="Blue" border="0" color="15793151" x="2213" y="8" height="60" width="142"  name=t_6  font.face="Tahoma" font.height="-8" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="16711680" )
text(band=header alignment="2" text="RGB" border="0" color="16777215" x="951" y="8" height="60" width="361"  name=t_1  font.face="Tahoma" font.height="-8" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="Rgb Num" border="0" color="16777215" x="1417" y="8" height="60" width="480"  name=t_3  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
column(band=detail id=1 alignment="2" tabsequence=32766 border="0" color="16777215~t rgb_num " x="9" y="8" height="64" width="457" format="[general]"  name=c_name edit.limit=0 edit.case=any edit.autoselect=yes  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
column(band=detail id=2 alignment="1" tabsequence=10 border="0" color="255" x="475" y="8" height="64" width="151" format="[general]"  name=c_red edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
column(band=detail id=3 alignment="1" tabsequence=20 border="0" color="65280" x="635" y="8" height="64" width="137" format="[general]"  name=c_green edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
column(band=detail id=4 alignment="1" tabsequence=30 border="0" color="8388608~trgb(0,0,255)" x="782" y="8" height="64" width="160" format="[general]"  name=c_blue edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )

#5


compute(band=detail alignment="1" expression="rgb_num -blue_c * 256 * 256 -green_c* 256"border="0" color="255~t255" x="1906" y="8" height="64" width="146" format="[General]"  name=red_c  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
compute(band=detail alignment="1" expression="int((rgb_num -blue_c * 256 * 256 ) / 256)"border="0" color="65280" x="2062" y="8" height="64" width="142" format="[GENERAL]"  name=green_c  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
compute(band=detail alignment="1" expression="int( rgb_num / 256 / 256)"border="0" color="16711680" x="2213" y="8" height="64" width="142" format="[GENERAL]"  name=blue_c  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
column(band=detail id=5 alignment="1" tabsequence=40 border="0" color="16777215~t rgb_num " x="1417" y="8" height="64" width="480" format="[general]"  name=rgb_num edit.limit=0 edit.case=any edit.autoselect=yes  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
compute(band=detail alignment="1" expression="rgb( c_red , c_green , c_blue )"border="0" color="16777215~t rgb_num " x="951" y="8" height="64" width="361" format="[GENERAL]"  name=rgb_color  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
compute(band=detail alignment="0" expression="space(2)"border="0" color="16777215" x="1321" y="0" height="80" width="87" format="[GENERAL]"  name=compute_1  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="0" background.color="536870912~t rgb_color " )
compute(band=detail alignment="0" expression="space(2)"border="0" color="16777215" x="2363" y="0" height="80" width="101" format="[GENERAL]"  name=compute_2  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="0" background.color="536870912~trgb_num" )
htmltable(border="1" )
htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" ) 
 
 
导入到PB中就能用了

#6


感谢各位顶力相助!我想rgb()函数的参数值不能大于255呢?
问题已解决!!
谢谢!!

#1


用BottonFace即可实现与窗口的背景色一致.

#2


Light Gray 192 192 192
Dark Gray          128          128          128

#3


就像进制转换一样,可以作为256进制转换,一共三位就是rgb的三个参数,其实没有必要,rgb就是要转换成颜色,既然已经知道颜色值,可以直接使用,还不用再rgb转换了。

#4


给你一个SRD
这是以前LIULEE老大给我的
里面说明了各种系统颜色的编码
很有加值的

太长了
分成了两部分,你把他们合并起来就能用了


$PBExportHeader$d_rgb_color_calculater.srd
release 7;
datawindow(units=0 timer_interval=0 color=16777215 processing=1 HTMLDW=no print.documentname="" print.orientation = 0 print.margin.left = 110 print.margin.right = 110 print.margin.top = 96 print.margin.bottom = 96 print.paper.source = 0 print.paper.size = 0 print.prompt=no print.buttons=no print.preview.buttons=no grid.lines=0 grid.columnmove=no selected.mouse=no )
header(height=72 color="0" )
summary(height=0 color="536870912" )
footer(height=0 color="536870912" )
detail(height=84 color="0~tif (c_name = 'TextColor',rgb(255,255,255),0)" )
table(column=(type=char(30) updatewhereclause=no name=c_name dbname="c_name" )
 column=(type=number updatewhereclause=no name=c_red dbname="c_red" initial="0" )
 column=(type=number updatewhereclause=no name=c_green dbname="c_green" initial="0" )
 column=(type=number updatewhereclause=no name=c_blue dbname="c_blue" initial="0" )
 column=(type=number updatewhereclause=no name=rgb_num dbname="rgb_num" )
 )
data("White", 255, 255, 255, 16777215,"Red", 255, 0, 0, 255,"Blue", 0, 0, 255, 16711680,"Green", 0, 255, 0, 65280,"Light Gray", 192, 192, 192, 12632256,"Dark Gray    ", 128, 128, 128, 8421504,"Dark Red", 128, 0, 0, 128,"Dark Green", 0, 128, 0, 32768,"Dark Blue    ", 0, 0, 128, 8388608,"Magenta", 255, 0, 255, 16711935,"Dark Magenta", 128, 0, 128, 8388736,"Cyan", 0, 255, 255, 16776960,"Dark Cyan", 0, 128, 128, 8421376,"Yellow    ", 255, 255, 0, 65535,"Brown", 128, 128, 0, 32896,"TextColor",null null null  33554432,"AppColor",null null null  276856960,"Transparent",null null null  553648127,"ButtonFace",null null null  80269524,"WndBKRnd",null null null  1090519039,"Color1", 239, 239, 223, 14675951,"color2", 217, 214, 168, 11065049,"LightYellow", 239, 216, 144, 9492719,null  214, 221, 198, 12771542,null  229, 229, 213, 14018021,null  219, 219, 203, 13360091,) 
text(band=header alignment="2" text="Color Name" border="0" color="16777215" x="9" y="8" height="60" width="457"  name=t_2  font.face="Tahoma" font.height="-8" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="Red" border="0" color="1090519039" x="475" y="8" height="60" width="151"  name=c_red_t  font.face="Tahoma" font.height="-8" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="255" )
text(band=header alignment="2" text="Green" border="0" color="33554432" x="635" y="8" height="60" width="137"  name=c_green_t  font.face="Tahoma" font.height="-8" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="65280" )
text(band=header alignment="2" text="Blue" border="0" color="15793151" x="782" y="8" height="60" width="160"  name=c_blue_t  font.face="Tahoma" font.height="-8" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="16711680" )
text(band=header alignment="2" text="Red" border="0" color="15793151" x="1906" y="8" height="60" width="146"  name=t_4  font.face="Tahoma" font.height="-8" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="255" )
text(band=header alignment="2" text="Green" border="0" color="33554432" x="2062" y="8" height="60" width="142"  name=t_5  font.face="Tahoma" font.height="-8" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="65280" )
text(band=header alignment="2" text="Blue" border="0" color="15793151" x="2213" y="8" height="60" width="142"  name=t_6  font.face="Tahoma" font.height="-8" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="2" background.color="16711680" )
text(band=header alignment="2" text="RGB" border="0" color="16777215" x="951" y="8" height="60" width="361"  name=t_1  font.face="Tahoma" font.height="-8" font.weight="400"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
text(band=header alignment="2" text="Rgb Num" border="0" color="16777215" x="1417" y="8" height="60" width="480"  name=t_3  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
column(band=detail id=1 alignment="2" tabsequence=32766 border="0" color="16777215~t rgb_num " x="9" y="8" height="64" width="457" format="[general]"  name=c_name edit.limit=0 edit.case=any edit.autoselect=yes  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
column(band=detail id=2 alignment="1" tabsequence=10 border="0" color="255" x="475" y="8" height="64" width="151" format="[general]"  name=c_red edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
column(band=detail id=3 alignment="1" tabsequence=20 border="0" color="65280" x="635" y="8" height="64" width="137" format="[general]"  name=c_green edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
column(band=detail id=4 alignment="1" tabsequence=30 border="0" color="8388608~trgb(0,0,255)" x="782" y="8" height="64" width="160" format="[general]"  name=c_blue edit.limit=0 edit.case=any edit.focusrectangle=no edit.autoselect=yes edit.autohscroll=yes  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )

#5


compute(band=detail alignment="1" expression="rgb_num -blue_c * 256 * 256 -green_c* 256"border="0" color="255~t255" x="1906" y="8" height="64" width="146" format="[General]"  name=red_c  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
compute(band=detail alignment="1" expression="int((rgb_num -blue_c * 256 * 256 ) / 256)"border="0" color="65280" x="2062" y="8" height="64" width="142" format="[GENERAL]"  name=green_c  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
compute(band=detail alignment="1" expression="int( rgb_num / 256 / 256)"border="0" color="16711680" x="2213" y="8" height="64" width="142" format="[GENERAL]"  name=blue_c  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
column(band=detail id=5 alignment="1" tabsequence=40 border="0" color="16777215~t rgb_num " x="1417" y="8" height="64" width="480" format="[general]"  name=rgb_num edit.limit=0 edit.case=any edit.autoselect=yes  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
compute(band=detail alignment="1" expression="rgb( c_red , c_green , c_blue )"border="0" color="16777215~t rgb_num " x="951" y="8" height="64" width="361" format="[GENERAL]"  name=rgb_color  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="1" background.color="536870912" )
compute(band=detail alignment="0" expression="space(2)"border="0" color="16777215" x="1321" y="0" height="80" width="87" format="[GENERAL]"  name=compute_1  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="0" background.color="536870912~t rgb_color " )
compute(band=detail alignment="0" expression="space(2)"border="0" color="16777215" x="2363" y="0" height="80" width="101" format="[GENERAL]"  name=compute_2  font.face="Tahoma" font.height="-8" font.weight="700"  font.family="2" font.pitch="2" font.charset="0" background.mode="0" background.color="536870912~trgb_num" )
htmltable(border="1" )
htmlgen(clientevents="1" clientvalidation="1" clientcomputedfields="1" clientformatting="0" clientscriptable="0" generatejavascript="1" ) 
 
 
导入到PB中就能用了

#6


感谢各位顶力相助!我想rgb()函数的参数值不能大于255呢?
问题已解决!!
谢谢!!