Class EmailBrand
java.lang.Object
io.meeds.portal.mail.model.EmailBrand
The brand an email is dressed in: the company name and the primary
color of the site, with the text color that stays readable on it
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringUsed when the site has no valid primary color: the default primary color of the platform themestatic final StringUsed when the site has no valid font, the default font of the platformstatic final StringUsed when the site has no valid border radius, as the platform does -
Constructor Summary
ConstructorsConstructorDescriptionEmailBrand(String companyName, String primaryColor) EmailBrand(String companyName, String primaryColor, String fontFamily, String borderRadius) -
Method Summary
Modifier and TypeMethodDescriptionstatic voidForgets the brand kept bycurrent(), so that the next call reads the theme againstatic EmailBrandcurrent()The brand of the site, for a template that has no branding service at hand; the default brand when the site cannot be reached.static EmailBrandfrom(org.exoplatform.portal.branding.BrandingService brandingService) getColor()
-
Field Details
-
DEFAULT_COLOR
Used when the site has no valid primary color: the default primary color of the platform theme- See Also:
-
DEFAULT_RADIUS
Used when the site has no valid border radius, as the platform does- See Also:
-
DEFAULT_FONT_FAMILY
Used when the site has no valid font, the default font of the platform- See Also:
-
-
Constructor Details
-
EmailBrand
- Parameters:
companyName- the name shown in the header of the emailprimaryColor- a #rgb, #rrggbb or #rrggbbaa color (the alpha is dropped); anything else, a css injection attempt included, is replaced byDEFAULT_COLOR
-
EmailBrand
- Parameters:
companyName- the name shown in the header of the emailprimaryColor- the main color of the site, as #rgb, #rrggbb or #rrggbbaafontFamily- the font of the platform branding; the default font of the platform when it is not a font nameborderRadius- the rounding of its buttons, from 0px to 29px;DEFAULT_RADIUSotherwise
-
-
Method Details
-
current
The brand of the site, for a template that has no branding service at hand; the default brand when the site cannot be reached. The brand is kept a few seconds, so that the many helper calls of one rendering (and of the emails sent in a row) read the theme once. A branding saved in the meantime shows in the emails after at mostCACHE_MILLISmilliseconds (five seconds). -
clearCache
public static void clearCache()Forgets the brand kept bycurrent(), so that the next call reads the theme again -
from
-
getCompanyName
-
getColor
- Returns:
- the primary color as #rrggbb
-
getFillColor
- Returns:
- the primary color as it is painted behind text (the header and the buttons): the color itself, or the nearest one that white text can be read on
-
getFontFamily
- Returns:
- the font of the platform branding, for the stack of fonts of the email: its name, as the administrator chose it in the branding
-
getFontStack
- Returns:
- the font of the platform branding first, then the fonts that every mail client has: the email asks for the platform font and takes Arial when the client does not have it; nothing is loaded from a third party, so a client that has not the font shows Arial
-
getOutlineColor
- Returns:
- the primary color, darkened as much as needed (and not more) to be seen as the outline of an outlined button on white: at least 3:1
-
getLinkColor
- Returns:
- the primary color, darkened as much as needed (and not more) to be read as the text of a link on white: at least 4.5:1
-
getRadius
- Returns:
- the rounding of the buttons, such as 8px
-
getTextColor
- Returns:
- the color of the text on the primary color (the company name and
the title of the header, the label of a button): always white, in
light and in dark mode. It is the fill that moves, so that white
reads on it (
getFillColor())
-