How the colours are worked out
Every character gets its own colour. The first takes your first colour exactly, the last takes your last, and the ones between are spaced evenly along the stops in order. RGB mixes the red, green and blue numbers directly, which is what most plugins do. Perceptual mixes in OKLab, a colour space built to match how the eye sees brightness, so the middle of red to green comes out a clear yellow rather than a muddy brown. A space shows no colour, so it takes no code of its own unless underline or strikethrough is on. Checked against Java Edition 26.3.
Which format to copy
&#RRGGBB is what Essentials, CMI, TAB and most chat, nickname and rank plugins read. MiniMessage is the format of Paper and plugins built on Adventure: the <gradient> tag is shortest, and the server works out the in-between colours itself, close to the RGB blend shown here; the <#RRGGBB> version spells out each colour, so it matches the preview exactly. §x is the form Bukkit and Spigot store hex colours in, for configs that take section signs. tellraw is a vanilla command, for the console, a command block or a function.
Vanilla servers and server.properties
A vanilla server.properties MOTD only understands the 16 legacy colours, so the last row gives each letter the nearest of the 16 and joins letters that land on the same one. A gradient between close colours may come out as one colour there. For a full two-line message, use the MOTD Generator; for every other setting, the server.properties Generator.
Watch the length
Each colour change costs 8 characters as &#RRGGBB and 14 as §x, and bold or italic adds 2 more per change, so a 16-letter name can become 150 characters. Chat, and so a command typed in chat, stops at 256 characters. Essentials keeps nicknames to 15 characters by default and counts the colour codes unless ignore-colors-in-max-nick-length is on. The count beside each output shows where you stand.
Questions
Why does my gradient show as FF0000 in the game?
The plugin reading it does not understand hex codes, or the server is older than 1.16, which is when hex colours arrived in Java Edition. Try the MiniMessage or §x version, or check which format your plugin's documentation names.
Can I use more than two colours?
Yes. Add as many stops as you like and reorder them with the arrows; the gradient runs through them in order, evenly spaced across the text.
Does Bedrock Edition support hex colours?
No. Bedrock text uses the legacy § colours only, plus a few colours of its own, so a gradient there is limited to the nearest legacy colours.
Is anything I type sent anywhere?
No. The colours are worked out in this page, on your device. The text and colours are kept in the page's address so a link brings them back; nothing is stored or sent.