diff --git a/lib/actions/apiV2.js b/lib/actions/apiV2.js index 16d6c5e1d..a10a06381 100644 --- a/lib/actions/apiV2.js +++ b/lib/actions/apiV2.js @@ -26,6 +26,7 @@ import { import { getRouteColorBasedOnSettings, getRouteIdForPattern, + getRouteTextColorBasedOnSettings, routeIsValid } from '../util/viewer' import { isLastStop } from '../util/stop-times' @@ -1144,6 +1145,16 @@ export function routingQuery(searchId = null, updateSearchInReducer) { config.transitOperators ), { color: leg?.route?.color, mode: leg.mode } + ).split('#')?.[1], + textColor: getRouteTextColorBasedOnSettings( + getRouteOperator( + { + agencyId: leg?.agency?.id, + id: leg?.route?.id + }, + config.transitOperators + ), + { color: leg?.route?.color, mode: leg.mode } ).split('#')?.[1] } } diff --git a/lib/util/viewer.js b/lib/util/viewer.js index d407b356c..45912bbd1 100644 --- a/lib/util/viewer.js +++ b/lib/util/viewer.js @@ -353,6 +353,10 @@ export function getRouteColorBasedOnSettings(operator = {}, route = {}) { return backgroundColor } } +export function getRouteTextColorBasedOnSettings(operator = {}, route = {}) { + const { color } = getColorAndNameFromRoute(operator, route) + return color +} /** * Helper method to determine if a stop being viewed is a flex stop. This is not marked by