function scoreToColor(score) {
    if (!score) {
        return '#cecece';
    }

    score = Math.round(( parseFloat(score) + Number.EPSILON) * 100);

    if (score  < 30) {
        return 'rgb(255,60,32)';
    } else if (score  >= 30 && score < 50) {
        return 'rgb(255,165,0)';
    } else if (score >= 50 && score < 70) {
        return 'rgb(14,165,233)';
    } else {
        return 'rgb(16,185,129)';
    }
}

function scoreToTag(score) {
    if (!score) {
        return 'no keyword';
    }

    score = Math.round(( parseFloat(score) + Number.EPSILON) * 100);

    if (score  < 30) {
        return 'poor';
    } else if (score  >= 30 && score < 50) {
        return 'average';
    } else if (score >= 50 && score < 70) {
        return 'good';
    } else {
        return 'great';
    }
}

function tagToColor(tag) {
    let color = '#cecece';
    switch (tag.toLowerCase()) {
        case 'poor':
            color = 'rgb(255,60,32)';
            break;
        case 'average':
            color = 'rgb(255,165,0)';
            break;
        case 'good':
            color = 'rgb(14,165,233)';
            break;
        case 'great':
            color = 'rgb(16,185,129)';
            break;
    }

    return color;
}

function tagToScore(tag) {
    let score = null;
    if (tag) {
        switch (tag.toLowerCase()) {
            case 'poor':
                score = [0, 29];
                break;
            case 'average':
                score = [30, 49];
                break;
            case 'good':
                score = [50, 69];
                break;
            case 'great':
                score = [70, 100];
                break;
        }
    }

    return score;
}