Somewhat tedious method but works:
I assume you have the same integer number values representing the class for the vector and the raster - eg. class "1" means "forest" both in the raster and the vector and you want them to have the same colour.
-First save your existing raster palette symbology to a file (Properties/Symbology --> "Style" button in bottom left corner --> "Save style")
-Open this new file you created in a text editor, such as Notepad++
-You will see the colour palette listed under the tag
"<colorPalette>", with a line such as
<paletteEntry value="1" alpha="255" label="1" color="#a86828"/>'
-Now open the properties of your vector file, and under "Symbology" select "Categorized" at the top of the panel. Click "classify" at the bottom. This will give you a list of all classes in the vector, with some random colour attached to each.
-Now right-click on the coloured square representing the symbol for the first class, and select modify colour. On the lower right of this panel you will find a text field for "html code" - a string of seven units, starting with a #.
-In the text editor, find the paletteEntry for the appropriate class, and copy the colour code (eg.
color="#a86828"
) from the end of the line.
-paste this string into the "html code" field of the vector symbol colour editor.
-Click OK - you will see in the properties panel that the colour for this category has changed.
-Repeat this for all categories of the vector, copying in the html code of the colour from the text of the raster palette.
-When you are done, save the resulting vector colour palette ("Style" button in the lower left --> "Save style")
Now you will have exactly the same colour form the matching classes in the raster and the vector.