# -*- coding: utf-8 -*-
"""
/***************************************************************************
 Sewercalc
                                 A QGIS plugin
 Plugin para dimensionamento de redes coletoras de esgoto 
 Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
                              -------------------
        begin                : 2025-02-07
        git sha              : $Format:%H$
        copyright            : (C) 2025 by Wanderilo  Lima
        email                : Wanderilo Lima
 ***************************************************************************/

/***************************************************************************
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 ***************************************************************************/
"""


import os
from qgis.core import (
    QgsProject,
    QgsSingleBandPseudoColorRenderer,
    QgsColorRampShader,
    QgsRasterShader,
    QgsRasterLayer,
    QgsVectorLayer
)
from PyQt5.QtGui import QColor

def aplicar_estilo(camada, nome_estilo):
    
    camada = QgsProject.instance().mapLayer(camada)
    
    caminho_arquivo = os.path.abspath(__file__)
    caminho_arquivo = os.path.dirname(caminho_arquivo)
    caminho_estilo = os.path.join(caminho_arquivo, "Estilos", nome_estilo)
    camada.loadNamedStyle(caminho_estilo)
    camada.triggerRepaint()
    