I ended up getting the category ID by using decoratePluginOutlet and then walking down and up the hierarchy to find the category link from the badge and add it to the topic div. Is there a better way to do this?
api.decoratePluginOutlet(
"full-page-search-category",
(elem, args) => {
let searchCategory = elem.parentElement.parentElement
let fpsTopic = searchCategory.parentElement.parentElement
let category_id = searchCategory.children[0].getAttribute('href').split("/").slice(-1);
console.log(category_id)
fpsTopic.classList.add("category_" + category_id)
}
);