If you go back to one of the older update posts for Sketch 54 I put some information there to get at global colors (https://sketchplugins.com/d/1335-what-s-new-sketch-54-beta). Document colors are very similar:
var sketch = require('sketch')
var selectedDocument = sketch.getSelectedDocument()
let documentColors = selectedDocument.colors
// an array of ColorAsset objects
// you can add colors like this
// you can also add named colors
Check the linked post for setting all the colors, removing colors, and adding gradients.