I'm not familiar with the show Black Sails, but I have watched and enjoyed the Pirates of the Caribbean movies, and I have to say that they are rather paradoxical in their representation of the Spanish sailors.
In the fourth film (On stranger tides), we get to see the Spaniard (played by Óscar Jaenada) and his troops, and they are dressed in a dark shade of blue, which would be appropriate for the period, which is somewhere around the 1740s. The long jacket, or more appropriately cassock, is blue with golden details, and that is an unmistakable sign of an officer. Here you can see a picture with reasonable qualityand acceptable lighting.
To offer some comparison, I will show you here some portraits of admirals active around that same time, so you can compare.
- Admiral Juan José Navarro, captain general of the Navy. The portrait is mid 19th century copy of an original from the 18th century. Here you can see Navarro with a dark blue cassock with golden details, and he is also wearing the red sash one would see on a Spanish general (even today).
- Admiral Manuel López Pintado. On this portrait, you can see him wearing a lighter shade of blue, but that may simply be due to the wear and tear. The golden details are continuous in their nature, as opposed to Navarro's ones. To be fair, Pintado's painting represents him at an earlier year, meaning Navarro's uniform is of a newe regulation. The general style is similar, though.
- Admiral Blas de Lezo, nowadays arch-famous in Spain. He wears a cassock that is basically the same as Pintado's in pattern, but made on a darker shade of blue.
- The inevitable Marqués de la Ensenada, also known as Zenón de Somodevilla y Bengoechea, painted in 1750. He is shown wearing a cassock that is identical to Navarro's one, complete with the red sash, the toison d'or, and all the bells and whistles.
- Corsair Amaro Pargo, who died in 1747, wore a dark blue cassock with golden details similar to the one used by Ensenada and Navarro, as shown on this painting on the chapel he sponsorised in the Canary Islands.
In the second half of the 18th century you see a different, simpler, more elegant pattern in the cassocks of the Spanish admirals, that however keeps the dark blue and gold elements, though adding red for the maunches and waistcoats, as shown in the portraits of these fine gentlemen:
- Admiral Juan de Lángara, painted ca. 1770.
- Admiral and chief engineerJoaquín Romero Landa, painted around the same date.
- Admiral and captain general Antonio Barceló, portrayed around the sama date.
Of course, you can argue that the examples I have given are all admirals, and that the crews would dress differently. That is true, but the regulations of uniformity established that the colours of the Spanish navy would be dark blue and red over it.
In case you want to read more on the specific regulations of the Spanish navy since 1700, complete with references to each and every ordinance, law, and decree, there is a phenomenal publication by the Spanish navy titled "Uniformes de la Armada. Tres siglos de historia (1700-2000)", which is readily available on this link here to the site of the Spanish Ministry of Defence.
Edit: Somehow I did not finish my answer, so I am going to complete it a bit. I said that the representation in Pirates of the Caribbean is very paradoxical because in Pirates 4 the uniforms were reasonably accurate, using dark shades of blue, which were appropriate for the time, and even the cassock worn by the character of Óscar Jaenada has the right type of ornaments. However, for the fifth film they thrrew their good sense out of the window and dressed Captain Armando Salazar in black and silver, which is entirely out of place. Furthermore, the elements we see on his uniform, like the fancy epaulettes are characteristic of the very late 18th century and the 19th century, nothing to do with a character whose story happens around 1750 and earlier.