Skip to main content
January 15, 2022
Question

Is it possible to change the color of a linkFied ?

  • January 15, 2022
  • 8 replies
  • 1 view

Hi,

I would need to colorise a a!linkField. I've tried with a!richTextDisplayField() and a!richTextItem(color: ...) but it does not work.

How would you do (if it is possible)?

a!gridColumn(
  label: "contract",
  value: a!linkField(
	links: {
	  a!recordLink( 
		label: ...,
		recordType: ...,
		identifier: ...,
	  )
	},
	align: "CENTER"
  ),
  align: "START",
  width: "NARROW_PLUS"
),               

Regards

8 replies

New Participant
January 15, 2022

Hi cedric,

Your thinking of using the a!richTextDisplayField actually should work.
Maybe you forgot to set the text parameter and just used the link. This example should work:

a!gridField(
data: local!data,
columns: {
  a!gridColumn(
	label: "contract",
	value: a!richTextDisplayField(
	  value: a!richTextItem(
		text: "Your link text in purple",
		link: a!recordLink( 
		  label: ...,
		  recordType: ...,
		  identifier: ...
		),
		color: "#800080" /*purple*/
	  ),
	  align: "CENTER"
	),
	align: "START",
	width: "NARROW_PLUS"
  )
}
)

It's important to pass the apperaing text as the parmeter (text) of the a!richTextItem().

Hope that helps!

//Kai

January 15, 2022

Thank you Kais, yes it works because you've removed the a!LinkField function.
I already used this workaround, but I would like to know if you can make it working, keeping the LinkField ? 

New Participant
January 15, 2022

Hi cedric,

Sure, because the a!linkField() doesn't support colouring. Therefore, you need to use the richText Object if you want to have control over the clour. May I ask why you want to use the linkField insted of the richText?