當前位置: 首頁>>代碼示例>>PHP>>正文


PHP td_util::html2rgb方法代碼示例

本文整理匯總了PHP中td_util::html2rgb方法的典型用法代碼示例。如果您正苦於以下問題:PHP td_util::html2rgb方法的具體用法?PHP td_util::html2rgb怎麽用?PHP td_util::html2rgb使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在td_util的用法示例。


在下文中一共展示了td_util::html2rgb方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: td_css_generator


//.........這裏部分代碼省略.........
    //load the user settings
    // general
    $td_css_compiler->load_setting('theme_color');
    $td_css_compiler->load_setting('grid_line_color');
    // header ---------
    $td_css_compiler->load_setting('top_menu_color');
    $td_css_compiler->load_setting('top_menu_text_color');
    $td_css_compiler->load_setting('top_menu_text_hover_color');
    $td_css_compiler->load_setting('top_sub_menu_text_color');
    $td_css_compiler->load_setting('top_sub_menu_text_hover_color');
    $td_css_compiler->load_setting('top_social_icons_color');
    $td_css_compiler->load_setting('top_social_icons_hover_color');
    $td_css_compiler->load_setting('menu_color');
    $td_css_compiler->load_setting('menu_text_color');
    $td_css_compiler->load_setting('menu_border_color');
    $td_css_compiler->load_setting('header_wrap_color');
    // footer ---------
    $td_css_compiler->load_setting('footer_color');
    $td_css_compiler->load_setting('footer_bottom_color');
    $td_css_compiler->load_setting('footer_bottom_text_color');
    // posts
    $td_css_compiler->load_setting('post_title_color');
    $td_css_compiler->load_setting('post_author_name_color');
    $td_css_compiler->load_setting('post_content_color');
    $td_css_compiler->load_setting('post_h_color');
    $td_css_compiler->load_setting('post_blockquote_color');
    // pages
    $td_css_compiler->load_setting('page_title_color');
    $td_css_compiler->load_setting('page_content_color');
    $td_css_compiler->load_setting('page_h_color');
    // modules and blocks
    $td_css_compiler->load_setting('module1_title_color');
    $td_css_compiler->load_setting('module2_title_color');
    $td_css_compiler->load_setting('module3_title_color');
    $td_css_compiler->load_setting('module4_title_color');
    $td_css_compiler->load_setting('module5_title_color');
    $td_css_compiler->load_setting('module6_title_color');
    $td_css_compiler->load_setting('module7_title_color');
    $td_css_compiler->load_setting('module8_title_color');
    $td_css_compiler->load_setting('module9_title_color');
    $td_css_compiler->load_setting('module10_title_color');
    $td_css_compiler->load_setting('module11_title_color');
    $td_css_compiler->load_setting('module12_title_color');
    $td_css_compiler->load_setting('module13_title_color');
    $td_css_compiler->load_setting('module14_title_color');
    $td_css_compiler->load_setting('module15_title_color');
    $td_css_compiler->load_setting('module_mx2_title_color');
    $td_css_compiler->load_setting('module_mx4_title_color');
    $td_css_compiler->load_setting('news_ticker_title_color');
    $td_css_compiler->load_setting('author_name_title_color');
    //load the selection color
    $tds_theme_color = td_util::get_option('tds_theme_color');
    if (!empty($tds_theme_color)) {
        //the select
        $td_css_compiler->load_setting_raw('select_color', td_util::adjustBrightness($tds_theme_color, 50));
        //the sliders text
        $td_css_compiler->load_setting_raw('slider_text', td_util::hex2rgba($tds_theme_color, 0.7));
    }
    /**
     * add td_fonts_css_buffer from database into the source of the page
     *
     * td_fonts_css_buffer : used to store the css generated for custom font files in the database
     */
    $td_fonts_css_buffer = td_fonts::td_add_fonts_css_buffer();
    /* add block styles */
    $td_block_styles = td_util::get_option('td_block_styles');
    //check if we have something set by the user
    if (!empty($td_block_styles)) {
        foreach ($td_block_styles as $style_name => $array_style_options) {
            foreach ($array_style_options as $option_key => $option_val) {
                if (!empty($td_block_styles[$style_name][$option_key])) {
                    $option_name_generator = str_replace('tds_', $style_name . '_', $option_key);
                    switch ($option_key) {
                        case 'tds_block_drop_down_background_color':
                            $td_css_compiler->load_setting_raw($option_name_generator, td_util::hex2rgba($td_block_styles[$style_name][$option_key], 0.95));
                            $td_css_compiler->load_setting_raw($option_name_generator . '_ie8', $td_block_styles[$style_name][$option_key]);
                            break;
                        case 'tds_block_module_post_comments_box_background_color':
                            $td_css_compiler->load_setting_raw($option_name_generator, $td_block_styles[$style_name][$option_key]);
                            //converting hex color to rgb
                            $rgb_color = td_util::html2rgb($td_block_styles[$style_name][$option_key]);
                            //converting rgb to hsl
                            $hsl_color = td_util::rgb2Hsl($rgb_color[0], $rgb_color[1], $rgb_color[2]);
                            //this is a hack for HLS color: red is 0 in HLS and no output is generated
                            if (intval($hsl_color[0] == 0)) {
                                $hsl_color[0] = 1;
                            }
                            $td_css_compiler->load_setting_raw($option_name_generator . '_after', $hsl_color[0]);
                            break;
                        default:
                            $td_css_compiler->load_setting_raw($option_name_generator, $td_block_styles[$style_name][$option_key]);
                    }
                }
            }
        }
    }
    //output the style
    //td_css_buffer::add($td_css_compiler->compile_css());
    return $td_fonts_css_buffer . $td_css_compiler->compile_css();
}
開發者ID:vikasjain1595,項目名稱:wordpresstheme,代碼行數:101,代碼來源:td_css_generator.php


注:本文中的td_util::html2rgb方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。