String (CefLoadHandler.@NotNull ErrorCode errorCode, @NotNull String errorText, @NotNull String failedUrl) { int fontSize = (int)(EditorColorsManager.getInstance().getGlobalScheme().getEditorFontSize() * 1.1); int headerFontSize = fontSize + JBUIScale.scale(3); int headerPaddingTop = headerFontSize / 5; int lineHeight = headerFontSize * 2; int iconPaddingRight = JBUIScale.scale(12); Color bgColor = JBColor.background(); String bgWebColor = String.format("#%02x%02x%02x", bgColor.getRed(), bgColor.getGreen(), bgColor.getBlue()); Color fgColor = JBColor.foreground(); String fgWebColor = String.format("#%02x%02x%02x", fgColor.getRed(), fgColor.getGreen(), fgColor.getBlue()); String html = ERROR_PAGE_READER.get(); html = html.replace("${lineHeight}", String.valueOf(lineHeight)); html = html.replace("${iconPaddingRight}", String.valueOf(iconPaddingRight)); html = html.replace("${fontSize}", String.valueOf(fontSize)); html = html.replace("${headerFontSize}", String.valueOf(headerFontSize)); html = html.replace("${headerPaddingTop}", String.valueOf(headerPaddingTop)); html = html.replace("${bgWebColor}", bgWebColor); html = html.replace("${fgWebColor}", fgWebColor); html = html.replace("${errorText}", errorText); html = html.replace("${failedUrl}", failedUrl); ScaleContext ctx = ScaleContext.create(); ctx.setScale(OBJ_SCALE.of(1.2 * headerFontSize / (float)ERROR_PAGE_ICON.getIconHeight())); // Reset sys scale to prevent raster downscaling on passing the image to jcef. // Overriding is used to prevent scale change during further intermediate context transformations. ctx.overrideScale(SYS_SCALE.of(1)); html = html.replace("${base64Image}", ObjectUtils.notNull(BASE64_ERROR_PAGE_ICON.get().getOrProvide(ctx), "")); return html; }