Point Posted January 25, 2022 Share Posted January 25, 2022 Hello, i have third party theme pack. the panel caption does not match with the original theme color. the panel caption always set to black. for this case I made a testcase using uni_sencha_classic. still using 1555, I read the 1556 changelog there is no fix information for this case. need temporary solution. Thanks. themepanel.7z Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 25, 2022 Share Posted January 25, 2022 24 minutes ago, Point said: i have third party theme pack. the panel caption does not match with the original theme color. the panel caption always set to black. for this case I made a testcase using uni_sencha_classic. Hello, Sorry, what should we pay attention to? Quote Link to comment Share on other sites More sharing options...
Point Posted January 25, 2022 Author Share Posted January 25, 2022 the caption color always set to black. Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 25, 2022 Share Posted January 25, 2022 7 minutes ago, Point said: the caption color always set to black. Font.Color ? Quote Link to comment Share on other sites More sharing options...
Point Posted January 25, 2022 Author Share Posted January 25, 2022 yes the font color Quote Link to comment Share on other sites More sharing options...
Sherzod Posted January 25, 2022 Share Posted January 25, 2022 2 minutes ago, Point said: yes the font color I mean, you can use the Font.Color Quote Link to comment Share on other sites More sharing options...
Point Posted January 25, 2022 Author Share Posted January 25, 2022 i use multiple theme in my project, the color font must follow the color of the theme. sorry mr sherzod, for my bad english. hope you understand. Quote Link to comment Share on other sites More sharing options...
Point Posted January 26, 2022 Author Share Posted January 26, 2022 hi @Sherzod, i am trying to use this approach : function form.afterrender(sender, eOpts) { const element = document.getElementById(sender.id + '-innerCt'); const cssObj = window.getComputedStyle(element, 'x-panel-body-default'); let aFontColor = cssObj.getPropertyValue("color"); console.log(aFontColor); ajaxRequest(sender, 'onGetColor',['aclr=' + aFontColor]); } == procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = 'onGetColor' then begin pubColor := Params['aclr'].AsString; end; end; == procedure TUniForm2.UniFormCreate(Sender: TObject); begin //===> UniPanel2.Font.Color := MainForm.pubColor; end; === result param : rgb(53, 53, 53) what kind function to convert rgb(53, 53, 53) color to TColor, the color must save in server side to avoid change back to black. Quote Link to comment Share on other sites More sharing options...
Point Posted January 27, 2022 Author Share Posted January 27, 2022 done with this approach : script : function RGBToHex(rgb) { // Choose correct separator let sep = rgb.indexOf(",") > -1 ? "," : " "; // Turn "rgb(r,g,b)" into [r,g,b] rgb = rgb.substr(4).split(")")[0].split(sep); let r = (+rgb[0]).toString(16), g = (+rgb[1]).toString(16), b = (+rgb[2]).toString(16); if (r.length == 1) r = "0" + r; if (g.length == 1) g = "0" + g; if (b.length == 1) b = "0" + b; return "#" + r + g + b; } function form.afterrender(sender, eOpts) { const abodypanel = document.getElementById(sender.id + '-body'); const cssObj = window.getComputedStyle(abodypanel, 'x-panel-body-default'); let aFontColor = cssObj.getPropertyValue('color'); ajaxRequest(sender, 'onGetColor',['aclr=' + RGBToHex(aFontColor)]); } === MainForm . . . public pubPanelFontColor : TColor end; function WebColorStrToColor(WebColor: string): TColor; begin if (Length(WebColor) <> 7) or (WebColor[1] <> '#') then Result := clBlack; Result := RGB( StrToInt('$' + Copy(WebColor, 2, 2)), StrToInt('$' + Copy(WebColor, 4, 2)), StrToInt('$' + Copy(WebColor, 6, 2))); end; procedure TMainForm.UniFormAjaxEvent(Sender: TComponent; EventName: string; Params: TUniStrings); begin if EventName = 'onGetColor' then begin pubPanelFontColor := WebColorStrToColor(Params['aclr'].AsString); end; end; Other Form : procedure TuniForm2.UniFormCreate(Sender: TObject); begin APanel.Font.Color := MainForm.pubPanelFontColor; end; @Farshad Mohajeriand @Sherzod, Please fix this issue for the next release. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.